Explorar el Código

Merge branch 'bugfix/ci/ci_fetch_submodule_fully_match_return_first_v4.1' into 'release/v4.1'

fix(ci): ci_fetch_submodule return full match name first (v4.1)

See merge request espressif/esp-idf!13212
Anton Maklakov hace 4 años
padre
commit
c6db3a426a
Se han modificado 1 ficheros con 10 adiciones y 5 borrados
  1. 10 5
      tools/ci/python_packages/gitlab_api.py

+ 10 - 5
tools/ci/python_packages/gitlab_api.py

@@ -37,17 +37,22 @@ class Gitlab(object):
         :return: project ID
         """
         projects = self.gitlab_inst.projects.list(search=name)
+        res = []
         for project in projects:
             if namespace is None:
                 if len(projects) == 1:
-                    project_id = project.id
+                    res.append(project.id)
                     break
+
             if project.namespace["path"] == namespace:
-                project_id = project.id
-                break
-        else:
+                if project.name == name:
+                    res.insert(0, project.id)
+                else:
+                    res.append(project.id)
+
+        if not res:
             raise ValueError("Can't find project")
-        return project_id
+        return res[0]
 
     def download_artifacts(self, job_id, destination):
         """