示例#1
0
    def install(self, workspace='job'):
        project_id = self.config.get('project_id')
        job_id = self.config.get('job_id')
        if workspace == 'job':
            home_path = self.job_space(project_id)
        else:
            home_path = self.build_space(project_id)

        Workspace.mkdir(home_path)
        store = home_path + '/' + job_id + '.zip'
        result = self.dowload_artifact(project_id, job_id, store)
        if not result:
            raise Exception('gitlab download artifacts failed')

        return home_path
示例#2
0
 def sync_mirror(self):
     dirname = self.cache_dir + '/' + self.project
     if not self.is_cached():
         Workspace.mkdir(dirname)
         git = Git(dirname)
         git.execute(['git', 'clone', '--mirror', self.repository, dirname])
         command = ['git', 'remote', 'add', 'eclogue', self.repository]
         git.execute(command)
         self.logger.info(' '.join(command))
         command = [
             'git', 'remote', 'set-url', '--push', 'origin', self.repository
         ]
         git.execute(command)
         self.logger.info(' '.join(command))
         command = ['git', 'remote', 'update', '--prune', 'origin']
         git.execute(command)
         self.logger.info(' '.join(command))
示例#3
0
    def install(self, workspace='job'):
        app_path = self.image.replace(':', '/')
        if workspace == 'job':
            home_path = self.job_space(app_path)
        else:
            home_path = self.build_space(app_path)

        working_dir = self.config.get('working_dir')
        Workspace.mkdir(home_path)
        filename = md5(str(uuid.uuid4()))
        store = home_path + '/' + filename + '.tar'
        with open(store, 'wb') as tar:
            bits, stat = self.get_archive(working_dir)
            for chunk in bits:
                tar.write(chunk)

            extract(store, home_path)
            os.unlink(store)
            # @todo store to mongodb gridfs
            if self.config.get('task_id'):
                pass