Changeset View
Changeset View
Standalone View
Standalone View
lilybuild/lilybuild/ci_steps.py
| from buildbot.plugins import * | from buildbot.plugins import * | ||||
| from buildbot.process import buildstep, logobserver | from buildbot.process import buildstep, logobserver | ||||
| from buildbot.interfaces import IRenderable | from buildbot.interfaces import IRenderable | ||||
| from twisted.internet import defer | from twisted.internet import defer | ||||
| from .ci_syntax import ci_file | from .ci_syntax import ci_file | ||||
| from .ci_syntax import rules as ci_rules | from .ci_syntax import rules as ci_rules | ||||
| from .helpers import rsync_rules_from_artifacts, get_job_script, normalize_image, normalize_services | from .helpers import rsync_rules_from_artifacts, get_job_script, normalize_image, normalize_services, ci_vars_to_env_file | ||||
| from .phorge import SendCoverageToPhorge | from .phorge import SendCoverageToPhorge | ||||
| import re | import re | ||||
| import sys | import sys | ||||
| import json | import json | ||||
| SAFETAR_EXEC = '/lilybuild/lilybuild/safetar.py' | SAFETAR_EXEC = '/lilybuild/lilybuild/safetar.py' | ||||
| COVERAGE_EXEC = '/lilybuild/lilybuild/coverage.py' | COVERAGE_EXEC = '/lilybuild/lilybuild/coverage.py' | ||||
| ▲ Show 20 Lines • Show All 167 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): | ||||
| name='Deploy pages', | name='Deploy pages', | ||||
| logEnviron=False, | logEnviron=False, | ||||
| doStepIf=doStepIf, | doStepIf=doStepIf, | ||||
| )) | )) | ||||
| return r | return r | ||||
| def job_to_steps(self, job, job_index, variables): | def job_to_steps(self, job, job_index, variables): | ||||
| script_name = self.script_dir + '/run.sh' | script_name = self.script_dir + '/run.sh' | ||||
| env_filename = self.script_dir + '/env' | |||||
| source_step = self.lbc.create_source_step() | source_step = self.lbc.create_source_step() | ||||
| script_step = steps.StringDownload( | script_step = steps.StringDownload( | ||||
| get_job_script(variables, job), | get_job_script(job), | ||||
| name='Set up script', | name='Set up script', | ||||
| workerdest=script_name, | workerdest=script_name, | ||||
| workdir=self.work_root_dir, | workdir=self.work_root_dir, | ||||
| doStepIf=on_success, | doStepIf=on_success, | ||||
| ) | ) | ||||
| env_step = steps.StringDownload( | |||||
| ci_vars_to_env_file(variables), | |||||
| name='Set up env file', | |||||
| workerdest=env_filename, | |||||
| workdir=self.work_root_dir, | |||||
| doStepIf=on_success, | |||||
| ) | |||||
| chmod_step = steps.ShellCommand( | chmod_step = steps.ShellCommand( | ||||
| name='Make script executable', | name='Make script executable', | ||||
| command=['chmod', '+x', script_name], | command=['chmod', '+x', script_name], | ||||
| workdir=self.work_root_dir, | workdir=self.work_root_dir, | ||||
| doStepIf=on_success, | doStepIf=on_success, | ||||
| ) | ) | ||||
| artifact_steps = [] | artifact_steps = [] | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | def job_to_steps(self, job, job_index, variables): | ||||
| 'rm', | 'rm', | ||||
| '-rf', | '-rf', | ||||
| self.script_dir, | self.script_dir, | ||||
| ], | ], | ||||
| workdir=self.work_root_dir, | workdir=self.work_root_dir, | ||||
| alwaysRun=True, | alwaysRun=True, | ||||
| ) | ) | ||||
| steps_to_run = [source_step, script_step, chmod_step] + artifact_steps + [run_step, clean_script_step] | steps_to_run = [source_step, script_step, chmod_step, env_step] + artifact_steps + [run_step, clean_script_step] | ||||
| if 'paths' in job.artifacts: | if 'paths' in job.artifacts: | ||||
| steps_to_run += self.get_upload_artifacts_jobs( | steps_to_run += self.get_upload_artifacts_jobs( | ||||
| 'files', | 'files', | ||||
| 'archive', | 'archive', | ||||
| self.artifact_file_name, | self.artifact_file_name, | ||||
| self.result_relative, | self.result_relative, | ||||
| job.artifacts.get('paths', []), | job.artifacts.get('paths', []), | ||||
| job.artifacts.get('exclude', []), | job.artifacts.get('exclude', []), | ||||
| ▲ Show 20 Lines • Show All 292 Lines • Show Last 20 Lines | |||||