From 6828b0fcc736b5d13f058b6b08d170de1349932a Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Mon, 19 Apr 2021 19:34:11 +0800 Subject: [PATCH] fix(ci): ci_fetch_submodule return full match name first --- tools/ci/python_packages/gitlab_api.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/ci/python_packages/gitlab_api.py b/tools/ci/python_packages/gitlab_api.py index d2e6abe7f7..feea21b575 100644 --- a/tools/ci/python_packages/gitlab_api.py +++ b/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): """