From 92b0152b3248dff39c8466845e3c1b1ce53e5637 Mon Sep 17 00:00:00 2001
From: cmoineau <cyril.moineau@cea.fr>
Date: Thu, 1 Feb 2024 14:44:13 +0000
Subject: [PATCH] Update script to retrieve project id.

---
 .gitlab/ci/shared_script.gitlab-ci.yml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/.gitlab/ci/shared_script.gitlab-ci.yml b/.gitlab/ci/shared_script.gitlab-ci.yml
index ca2aea2..7f7d825 100644
--- a/.gitlab/ci/shared_script.gitlab-ci.yml
+++ b/.gitlab/ci/shared_script.gitlab-ci.yml
@@ -23,7 +23,11 @@
           echo "Pull from branch name"
           BRANCH_TO_PULL=${CI_COMMIT_REF_NAME}
       fi
-    - echo "curling from https://gitlab.eclipse.org/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/$BRANCH_TO_PULL/download?job=$DEPENDENCY_JOB"
-    - curl -f --location --output build_artifacts.zip "https://gitlab.eclipse.org/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/$BRANCH_TO_PULL/download?job=$DEPENDENCY_JOB"
+    - apt-get install jq
+    - DEPENDENCY_ID=$(curl --header  "https://gitlab.example.com/api/v4/groups/${CI_PROJECT_NAMESPACE_ID}/projects?search=${DEPENDENCY_NAME}" | jq -r '.[0].id')
+    - echo "Project ID for ${DEPENDENCY_NAME} is ${DEPENDENCY_ID}"
+
+    - echo "curling from https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/jobs/artifacts/$BRANCH_TO_PULL/download?job=$DEPENDENCY_JOB"
+    - curl -f --location --output build_artifacts.zip "https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/jobs/artifacts/$BRANCH_TO_PULL/download?job=$DEPENDENCY_JOB"
     - unzip -o build_artifacts.zip -d .
     - rm -rf build_cpp
-- 
GitLab