From 78c5a09dfd9c1cb953d994758cab7d139dcca32c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire?= <gregoire.kubler@proton.me>
Date: Thu, 21 Nov 2024 11:57:23 +0100
Subject: [PATCH] chore : generalized DEP_API_URL call in ubuntu slect jobs

---
 .gitlab/ci/download/select_jobs.gitlab-ci.yml | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/.gitlab/ci/download/select_jobs.gitlab-ci.yml b/.gitlab/ci/download/select_jobs.gitlab-ci.yml
index 5ac4274..610c45a 100644
--- a/.gitlab/ci/download/select_jobs.gitlab-ci.yml
+++ b/.gitlab/ci/download/select_jobs.gitlab-ci.yml
@@ -141,19 +141,19 @@
         # Retrieve latest successful $DEPENDENCY_JOB from $BRANCH_TO_PULL (including MR pipelines)
         # and sort them from newest to oldest
         echo "Retrieving pipelines from $BRANCH_TO_PULL"
-        echo "Regular pipeline curled from \"$API_URL/projects/$DEP_ID/pipelines?ref=${BRANCH_TO_PULL}\""
-        PIPELINES=$(curl -s "$API_URL/projects/$DEP_ID/pipelines?ref=${BRANCH_TO_PULL}")
+        echo "Regular pipeline curled from \"$DEP_API_URL/pipelines?ref=${BRANCH_TO_PULL}\""
+        PIPELINES=$(curl -s "$DEP_API_URL/pipelines?ref=${BRANCH_TO_PULL}")
         if [[ -z "$PIPELINES" ]]; then
         	echo "Failed to retrieve any pipeline, ensure there is a pipeline with ref $BRANCH_TO_PULL in $DEP_NAME"
         	exit 1
         fi
         echo "Found $(jq length <<<$PIPELINES) regular pipelines with $BRANCH_TO_PULL as ref."
 
-        echo "Retrieve first affiliated MR by curling \"$API_URL/projects/$DEP_ID/merge_requests?source_branch=$BRANCH_TO_PULL&state=opened\""
-        MR_ID=$(curl -s "$API_URL/projects/$DEP_ID/merge_requests?source_branch=$BRANCH_TO_PULL&state=opened" | jq '.[0].iid')
+        echo "Retrieve first affiliated MR by curling \"$DEP_API_URL/merge_requests?source_branch=$BRANCH_TO_PULL&state=opened\""
+        MR_ID=$(curl -s "$DEP_API_URL/merge_requests?source_branch=$BRANCH_TO_PULL&state=opened" | jq '.[0].iid')
         if [[ $MR_ID != null ]]; then
-        	echo "MR pipeline curled from \"$API_URL/projects/$DEP_ID/merge_requests/$MR_ID/pipelines\""
-        	MR_PIPELINES=$(curl -s "$API_URL/projects/$DEP_ID/merge_requests/$MR_ID/pipelines")
+        	echo "MR pipeline curled from \"$DEP_API_URL/merge_requests/$MR_ID/pipelines\""
+        	MR_PIPELINES=$(curl -s "$DEP_API_URL/merge_requests/$MR_ID/pipelines")
         	echo "Found $(jq length <<<$MR_PIPELINES) Merge Request pipelines with $BRANCH_TO_PULL as source_branch."
         else
         	echo "No merge request with source_branch = \"$BRANCH_TO_PULL\" found."
@@ -188,7 +188,7 @@
         for i in $(seq 0 $(($(jq length <<<$PIPELINES) - 1))); do
         	PIPELINE_ID=$(jq --argjson idx $i '.[$idx].id' <<<$PIPELINES)
         	echo "Current pipeline ID : $PIPELINE_ID"
-        	echo "Retrieving jobs of curr pipeline from : \"$API_URL/projects/$DEP_ID/pipelines/$PIPELINE_ID/jobs\""
+        	echo "Retrieving jobs of curr pipeline from : \"$DEP_API_URL/pipelines/$PIPELINE_ID/jobs\""
         	JOBS=$(curl -s "$DEP_API_URL/pipelines/$PIPELINE_ID/jobs")
         	if [[ $(jq -r '.message' <<<$JOBS) == "404 Not found" ]]; then
         		echo "WARNING: NO JOBS FOUND FOR PIPELINE $PIPELINE_ID OF PROJECT $DEP_NAME."
-- 
GitLab