def deploy(self): ''' 2.检出代码 :param project_name: :return: ''' self.stage = self.stage_deploy self.sequence = 2 # # # copy to a local version # self.release_version = '%s_%s_%s' % ( # self.project_name, self.task_id, time.strftime('%Y%m%d_%H%M%S', time.localtime(time.time()))) with self.localhost.cd(self.local_codebase): command = 'cp -rf %s %s' % (self.dir_codebase_project, self.release_version) current_app.logger.info('cd %s command: %s ', self.dir_codebase_project, command) result = self.localhost.local(command, wenv=self.config()) # 更新到指定 branch/commit_id 或 tag repo = Repo(self.local_codebase + self.release_version) if self.project_info['repo_mode'] == ProjectModel.repo_mode_branch: repo.checkout_2_commit(branch=self.taskMdl['branch'], commit=self.taskMdl['commit_id']) else: repo.checkout_2_tag(tag=self.taskMdl['tag'])
def deploy(self): ''' 2.检出代码 :param project_name: :return: ''' self.stage = self.stage_deploy self.sequence = 2 # # # copy to a local version # self.release_version = '%s_%s_%s' % ( # self.project_name, self.task_id, time.strftime('%Y%m%d_%H%M%S', time.localtime(time.time()))) with self.localhost.cd(self.local_codebase): command = 'cp -rf %s %s' % (self.dir_codebase_project, self.release_version) current_app.logger.info('cd %s command: %s ', self.dir_codebase_project, command) result = self.localhost.local(command, wenv=self.config()) # 更新到指定 branch/commit_id 或 tag repo = Repo(self.local_codebase + self.release_version) if self.project_info['repo_mode'] == ProjectModel.repo_mode_branch: repo.checkout_2_commit(branch=self.taskMdl['branch'], commit=self.taskMdl['commit_id']) else: repo.checkout_2_tag(tag=self.taskMdl['tag'])
def init_repo(self): repo = Repo(self.dir_codebase_project) repo.init(url=self.project_info['repo_url'])
def list_commit(self, branch): repo = Repo(self.dir_codebase_project) repo.init(url=self.project_info['repo_url']) return repo.commits(branch)
def list_branch(self): repo = Repo(self.dir_codebase_project) repo.init(url=self.project_info['repo_url']) return repo.branches()
def list_tag(self): repo = Repo(self.dir_codebase_project) repo.init(url=self.project_info['repo_url']) return repo.tags()
def init_repo(self): repo = Repo(self.dir_codebase_project) repo.init(url=self.project_info['repo_url'])
def list_commit(self, branch): repo = Repo(self.dir_codebase_project) repo.init(url=self.project_info['repo_url']) return repo.commits(branch)
def list_branch(self): repo = Repo(self.dir_codebase_project) repo.init(url=self.project_info['repo_url']) return repo.branches()
def list_tag(self): repo = Repo(self.dir_codebase_project) repo.init(url=self.project_info['repo_url']) return repo.tags()