From 0036e361413616c18c817e1b025b514f1ef358e6 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 25 Jul 2024 10:50:44 +0200 Subject: [PATCH] when collecting jobs, exclude timed-out or stuck ones --- ci/get_id_of_last_job_occurence.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ci/get_id_of_last_job_occurence.py b/ci/get_id_of_last_job_occurence.py index 465d4c19a1..f7540523b9 100755 --- a/ci/get_id_of_last_job_occurence.py +++ b/ci/get_id_of_last_job_occurence.py @@ -65,9 +65,12 @@ def get_job_id(branch_name, job_name, project_id, success_only): if job_name not in resp_jobs.text: continue - # find actual job by name + # find actual job by name, exclude timed out or stuck jobs for job in resp_jobs.json(): - if job["name"] == job_name: + name_matches = job["name"] == job_name + is_success = job["status"] == "success" + has_timed_out = job.get("failure_reason", "") == "stuck_or_timeout_failure" + if name_matches and (is_success or not has_timed_out): job_id = job["id"] break if job_id >= 0: -- GitLab