Selaa lähdekoodia

Merge branch 'bugfix/ci_handle_retried_jobs' into 'master'

CI: fix CI fail when have retried build jobs

See merge request espressif/esp-idf!7435
Angus Gratton 6 vuotta sitten
vanhempi
sitoutus
4e4bfb4348
1 muutettua tiedostoa jossa 4 lisäystä ja 2 poistoa
  1. 4 2
      tools/ci/python_packages/gitlab_api.py

+ 4 - 2
tools/ci/python_packages/gitlab_api.py

@@ -96,12 +96,14 @@ class Gitlab(object):
 
 
         return raw_data_list
         return raw_data_list
 
 
-    def find_job_id(self, job_name, pipeline_id=None):
+    def find_job_id(self, job_name, pipeline_id=None, job_status="success"):
         """
         """
         Get Job ID from job name of specific pipeline
         Get Job ID from job name of specific pipeline
 
 
         :param job_name: job name
         :param job_name: job name
         :param pipeline_id: If None, will get pipeline id from CI pre-defined variable.
         :param pipeline_id: If None, will get pipeline id from CI pre-defined variable.
+        :param job_status: status of job. One pipeline could have multiple jobs with same name after retry.
+                           job_status is used to filter these jobs.
         :return: a list of job IDs (parallel job will generate multiple jobs)
         :return: a list of job IDs (parallel job will generate multiple jobs)
         """
         """
         job_id_list = []
         job_id_list = []
@@ -112,7 +114,7 @@ class Gitlab(object):
         for job in jobs:
         for job in jobs:
             match = self.JOB_NAME_PATTERN.match(job.name)
             match = self.JOB_NAME_PATTERN.match(job.name)
             if match:
             if match:
-                if match.group(1) == job_name:
+                if match.group(1) == job_name and job.status == job_status:
                     job_id_list.append({"id": job.id, "parallel_num": match.group(3)})
                     job_id_list.append({"id": job.id, "parallel_num": match.group(3)})
         return job_id_list
         return job_id_list