From 42f80d388369b44caa91725bf3fa0c0c8e28a41f Mon Sep 17 00:00:00 2001 From: cmoineau <cyril.moineau@cea.fr> Date: Wed, 28 Feb 2024 15:00:57 +0000 Subject: [PATCH] Robustify script to use hardcoded ID if unknown group is used. --- .gitlab/ci/shared_script.gitlab-ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitlab/ci/shared_script.gitlab-ci.yml b/.gitlab/ci/shared_script.gitlab-ci.yml index 59ad557..dfdbd6d 100644 --- a/.gitlab/ci/shared_script.gitlab-ci.yml +++ b/.gitlab/ci/shared_script.gitlab-ci.yml @@ -24,7 +24,14 @@ BRANCH_TO_PULL=${CI_COMMIT_REF_NAME} fi - apt-get install -y jq - - DEPENDENCY_ID=$(curl "https://gitlab.eclipse.org/api/v4/groups/${CI_PROJECT_NAMESPACE_ID}/projects?search=${DEPENDENCY_NAME}" | jq -r '.[0].id') + # Check group namespace is valid, if not DEPENDENCY_ID=6437 (aidge group ID) + - > + if [ $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/api/v4/groups/${CI_PROJECT_NAMESPACE_ID}") -eq 404 ]; then + DEPENDENCY_ID=$(curl "https://gitlab.eclipse.org/api/v4/groups/${CI_PROJECT_NAMESPACE_ID}/projects?search=${DEPENDENCY_NAME}" | jq -r '.[0].id') + else + echo "Using aidge group id by default" + DEPENDENCY_ID=6437 + fi - 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" -- GitLab