Changeset View
Changeset View
Standalone View
Standalone View
lilybuild/lilybuild/ci_steps.py
| Show First 20 Lines • Show All 472 Lines • ▼ Show 20 Lines | def stage_to_step(self, stage_name, stage_jobs, job_name_to_index_map, ci_file): | ||||
| lbc=self.lbc, | lbc=self.lbc, | ||||
| jobs_with_data=jobs_with_data, | jobs_with_data=jobs_with_data, | ||||
| waitForFinish=True, | waitForFinish=True, | ||||
| doStepIf=on_success, | doStepIf=on_success, | ||||
| ) | ) | ||||
| return trigger | return trigger | ||||
| def get_steps(self, stdout): | def get_steps_and_job_map(self, stdout): | ||||
| f = ci_file.CIFile(stdout) | f = ci_file.CIFile(stdout) | ||||
| stages = f.get_grouped_jobs() | stages = f.get_grouped_jobs() | ||||
| jobs = [job for (stage, js) in f.get_grouped_jobs() for job in js] | jobs = [job for (stage, js) in f.get_grouped_jobs() for job in js] | ||||
| job_names = [job.name for job in jobs] | job_names = [job.name for job in jobs] | ||||
| job_name_to_index_map = {} | job_name_to_index_map = {} | ||||
| for (i, j) in enumerate(jobs): | for (i, j) in enumerate(jobs): | ||||
| job_name_to_index_map[j.name] = i | job_name_to_index_map[j.name] = i | ||||
| steps = [self.stage_to_step(stage_name, stage_jobs, job_name_to_index_map, f) for (stage_name, stage_jobs) in stages] | steps = [self.stage_to_step(stage_name, stage_jobs, job_name_to_index_map, f) for (stage_name, stage_jobs) in stages] | ||||
| print('steps:', steps) | print('steps:', steps) | ||||
| return steps | return (steps, job_name_to_index_map) | ||||
| def get_is_phorge(self): | def get_is_phorge(self): | ||||
| return not not self.getProperty(self.build_target_prop_name) | return not not self.getProperty(self.build_target_prop_name) | ||||
| def get_ref_and_type(self): | def get_ref_and_type(self): | ||||
| ref_type = 'branch' | ref_type = 'branch' | ||||
| ref = self.getProperty('branch') | ref = self.getProperty('branch') | ||||
| Show All 40 Lines | def run(self): | ||||
| yield self.runCommand(cmd) | yield self.runCommand(cmd) | ||||
| # if the command passes extract the list of stages | # if the command passes extract the list of stages | ||||
| result = cmd.results() | result = cmd.results() | ||||
| if result == util.SUCCESS: | if result == util.SUCCESS: | ||||
| pipeline_vars = yield self.get_pipeline_ci_vars() | pipeline_vars = yield self.get_pipeline_ci_vars() | ||||
| self.setProperty('lilybuild_pipeline_vars', pipeline_vars, self.__class__.__name__) | self.setProperty('lilybuild_pipeline_vars', pipeline_vars, self.__class__.__name__) | ||||
| # create a ShellCommand for each stage and add them to the build | # create a ShellCommand for each stage and add them to the build | ||||
| self.build.addStepsAfterCurrentStep(self.get_steps(self.observer.getStdout())) | (steps, job_map) = self.get_steps_and_job_map(self.observer.getStdout()) | ||||
| self.setProperty('lilybuild_job_map', job_map, self.__class__.__name__) | |||||
| self.build.addStepsAfterCurrentStep(steps) | |||||
| latest_branch_map = self.get_cur_repo_config()['artifact_latest_branch_map'] | latest_branch_map = self.get_cur_repo_config()['artifact_latest_branch_map'] | ||||
| ref, _ref_type = self.get_ref_and_type() | ref, _ref_type = self.get_ref_and_type() | ||||
| if ref in latest_branch_map: | if ref in latest_branch_map: | ||||
| latest_name = latest_branch_map[ref] | latest_name = latest_branch_map[ref] | ||||
| self.build.addStepsAfterLastStep([ | self.build.addStepsAfterLastStep([ | ||||
| EnsureLatestDirs(lbc=self.lbc, storage_dir=self.storage_dir), | EnsureLatestDirs(lbc=self.lbc, storage_dir=self.storage_dir), | ||||
| MarkLatest( | MarkLatest( | ||||
| Show All 16 Lines | |||||