Changeset View
Changeset View
Standalone View
Standalone View
lilybuild/lilybuild/ci_steps.py
| Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | def __init__( | ||||
| self.repo_id = repo_id | self.repo_id = repo_id | ||||
| self.artifact_stage_relative = artifact_stage_relative | self.artifact_stage_relative = artifact_stage_relative | ||||
| self.artifact_stage_dir = artifact_stage_dir | self.artifact_stage_dir = artifact_stage_dir | ||||
| self.result_relative = result_relative | self.result_relative = result_relative | ||||
| self.result_dir = result_dir | self.result_dir = result_dir | ||||
| self.artifact_link_base = artifact_link_base | self.artifact_link_base = artifact_link_base | ||||
| super().__init__(name='Run step', **kwargs) | super().__init__(name='Run step', **kwargs) | ||||
| def get_cur_repo_config(self): | |||||
| return self.lbc.repos[self.getProperty('lilybuild_repo_id')] | |||||
| @defer.inlineCallbacks | @defer.inlineCallbacks | ||||
| def run(self): | def run(self): | ||||
| job_prop = self.getProperty('lilybuild_job_prop') | job_prop = self.getProperty('lilybuild_job_prop') | ||||
| job = ci_file.CIJob.from_prop(job_prop) | job = ci_file.CIJob.from_prop(job_prop) | ||||
| job_index = self.getProperty('lilybuild_job_index') | job_index = self.getProperty('lilybuild_job_index') | ||||
| variables = yield self.get_ci_variables(job) | variables = yield self.get_ci_variables(job) | ||||
| should_run = True | should_run = True | ||||
| ▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | def get_upload_artifacts_jobs(self, short_name, artifact_type, artifact_name, base_dir, paths, exclude, master_pattern, job_index, doStepIf=on_success, has_pages=False): | ||||
| ], | ], | ||||
| initialStdin=json.dumps({ | initialStdin=json.dumps({ | ||||
| 'op': 'create', | 'op': 'create', | ||||
| 'archive_file': artifact_name, | 'archive_file': artifact_name, | ||||
| 'base_dir': base_dir, | 'base_dir': base_dir, | ||||
| 'content': paths, | 'content': paths, | ||||
| 'items_to_exclude': exclude, | 'items_to_exclude': exclude, | ||||
| 'compression': 'gz', | 'compression': 'gz', | ||||
| 'limit_bytes': self.get_cur_repo_config()['artifact_uncompressed_limit'], | |||||
| }), | }), | ||||
| workdir=self.work_root_dir, | workdir=self.work_root_dir, | ||||
| doStepIf=doStepIf, | doStepIf=doStepIf, | ||||
| ) | ) | ||||
| masterdest = util.Interpolate( | masterdest = util.Interpolate( | ||||
| master_pattern, | master_pattern, | ||||
| st=self.storage_dir, | st=self.storage_dir, | ||||
| job=job_index, | job=job_index, | ||||
| doStepIf=doStepIf, | doStepIf=doStepIf, | ||||
| ) | ) | ||||
| parent_build_id = self.getProperty('lilybuild_pipeline_vars')['CI_PIPELINE_ID'] | parent_build_id = self.getProperty('lilybuild_pipeline_vars')['CI_PIPELINE_ID'] | ||||
| artifact_url = f'{self.artifact_link_base}/plugins/lilybuild_artifacts/builds/{parent_build_id}/jobs/{job_index}/artifacts/{artifact_type}' if self.artifact_link_base else None | artifact_url = f'{self.artifact_link_base}/plugins/lilybuild_artifacts/builds/{parent_build_id}/jobs/{job_index}/artifacts/{artifact_type}' if self.artifact_link_base else None | ||||
| upload_artifact_step = steps.FileUpload( | upload_artifact_step = steps.FileUpload( | ||||
| workersrc=artifact_name, | workersrc=artifact_name, | ||||
| maxsize=self.artifact_max_size, | maxsize=self.get_cur_repo_config()['artifact_compressed_limit'], | ||||
| name=f'Upload artifacts: {short_name}', | name=f'Upload artifacts: {short_name}', | ||||
| masterdest=masterdest, | masterdest=masterdest, | ||||
| workdir=self.work_root_dir, | workdir=self.work_root_dir, | ||||
| url=artifact_url, | url=artifact_url, | ||||
| doStepIf=doStepIf, | doStepIf=doStepIf, | ||||
| ) | ) | ||||
| r = [archive_artifact_step, upload_artifact_step] | r = [archive_artifact_step, upload_artifact_step] | ||||
| if has_pages: | if has_pages: | ||||
| Show All 39 Lines | def job_to_steps(self, job, job_index, variables): | ||||
| for i in dep_job_indices: | for i in dep_job_indices: | ||||
| # The steps may not run or may not have an artifact even if it runs | # The steps may not run or may not have an artifact even if it runs | ||||
| download_job = steps.FileDownload( | download_job = steps.FileDownload( | ||||
| mastersrc=util.Interpolate( | mastersrc=util.Interpolate( | ||||
| self.master_job_artifact_file_name_pattern, | self.master_job_artifact_file_name_pattern, | ||||
| st=self.storage_dir, | st=self.storage_dir, | ||||
| job=i, | job=i, | ||||
| ), | ), | ||||
| maxsize=self.artifact_max_size, | maxsize=self.get_cur_repo_config()['artifact_compressed_limit'], | ||||
| name=f'Download artifacts from job #{i}', | name=f'Download artifacts from job #{i}', | ||||
| workerdest=self.artifact_file_name, | workerdest=self.artifact_file_name, | ||||
| workdir=self.work_root_dir, | workdir=self.work_root_dir, | ||||
| doStepIf=on_success, | doStepIf=on_success, | ||||
| haltOnFailure=False, | haltOnFailure=False, | ||||
| flunkOnFailure=False, | flunkOnFailure=False, | ||||
| # https://github.com/buildbot/buildbot/issues/3709 | # https://github.com/buildbot/buildbot/issues/3709 | ||||
| blocksize=256 * 1024, | blocksize=256 * 1024, | ||||
| ▲ Show 20 Lines • Show All 275 Lines • Show Last 20 Lines | |||||