diff options
author | Eric Engestrom <eric@igalia.com> | 2024-02-05 22:59:51 +0000 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2024-02-08 22:22:54 +0000 |
commit | bce1230587d8ebf611b5286973c4cb814025a94c (patch) | |
tree | 52387cc70d01eddc4fe4617e1a73474ae457f30e /bin | |
parent | 5758a5d660217684bdc4684a031ce93e0f263e65 (diff) |
ci_run_n_monitor: update job when it goes through enable_job()
`enable_job()` modifies the job, so we need to make sure we get the
updated job back out of it.
The next two commits take care of the two specific code paths.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27499>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ci/ci_run_n_monitor.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/ci/ci_run_n_monitor.py b/bin/ci/ci_run_n_monitor.py index c7126471ab2..f2489bcf0de 100755 --- a/bin/ci/ci_run_n_monitor.py +++ b/bin/ci/ci_run_n_monitor.py @@ -120,10 +120,10 @@ def monitor_pipeline( stress < 0 or sum(stress_status_counter[job.name].values()) < stress ): - enable_job(project, job, "retry", force_manual) + job = enable_job(project, pipeline, job, "retry", force_manual) stress_status_counter[job.name][job.status] += 1 else: - enable_job(project, job, "target", force_manual) + job = enable_job(project, pipeline, job, "target", force_manual) print_job_status(job, job.status not in target_statuses[job.name]) target_statuses[job.name] = job.status @@ -136,7 +136,7 @@ def monitor_pipeline( # run dependencies and cancel the rest if job.name in dependencies: - enable_job(project, job, "dep", True) + job = enable_job(project, pipeline, job, "dep", True) if job.status == "failed": deps_failed.append(job.name) else: @@ -193,17 +193,18 @@ def monitor_pipeline( def enable_job( project: gitlab.v4.objects.Project, + pipeline: gitlab.v4.objects.ProjectPipeline, job: gitlab.v4.objects.ProjectPipelineJob, action_type: Literal["target", "dep", "retry"], force_manual: bool, -) -> None: +) -> gitlab.v4.objects.ProjectPipelineJob: """enable job""" if ( (job.status in ["success", "failed"] and action_type != "retry") or (job.status == "manual" and not force_manual) or job.status in ["skipped", "running", "created", "pending"] ): - return + return job pjob = project.jobs.get(job.id, lazy=True) @@ -221,6 +222,8 @@ def enable_job( print(Fore.MAGENTA + f"{jtype} job {job.name} manually enabled" + Style.RESET_ALL) + return job + def cancel_job(project, job) -> None: """Cancel GitLab job""" |