Skip to content
Snippets Groups Projects
Commit 78c5a09d authored by Grégoire Kubler's avatar Grégoire Kubler
Browse files

chore : generalized DEP_API_URL call in ubuntu slect jobs

parent 1482934a
No related branches found
No related tags found
No related merge requests found
...@@ -141,19 +141,19 @@ ...@@ -141,19 +141,19 @@
# Retrieve latest successful $DEPENDENCY_JOB from $BRANCH_TO_PULL (including MR pipelines) # Retrieve latest successful $DEPENDENCY_JOB from $BRANCH_TO_PULL (including MR pipelines)
# and sort them from newest to oldest # and sort them from newest to oldest
echo "Retrieving pipelines from $BRANCH_TO_PULL" echo "Retrieving pipelines from $BRANCH_TO_PULL"
echo "Regular pipeline curled from \"$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 "$API_URL/projects/$DEP_ID/pipelines?ref=${BRANCH_TO_PULL}") PIPELINES=$(curl -s "$DEP_API_URL/pipelines?ref=${BRANCH_TO_PULL}")
if [[ -z "$PIPELINES" ]]; then if [[ -z "$PIPELINES" ]]; then
echo "Failed to retrieve any pipeline, ensure there is a pipeline with ref $BRANCH_TO_PULL in $DEP_NAME" echo "Failed to retrieve any pipeline, ensure there is a pipeline with ref $BRANCH_TO_PULL in $DEP_NAME"
exit 1 exit 1
fi fi
echo "Found $(jq length <<<$PIPELINES) regular pipelines with $BRANCH_TO_PULL as ref." 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\"" echo "Retrieve first affiliated MR by curling \"$DEP_API_URL/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') MR_ID=$(curl -s "$DEP_API_URL/merge_requests?source_branch=$BRANCH_TO_PULL&state=opened" | jq '.[0].iid')
if [[ $MR_ID != null ]]; then if [[ $MR_ID != null ]]; then
echo "MR pipeline curled from \"$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 "$API_URL/projects/$DEP_ID/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." echo "Found $(jq length <<<$MR_PIPELINES) Merge Request pipelines with $BRANCH_TO_PULL as source_branch."
else else
echo "No merge request with source_branch = \"$BRANCH_TO_PULL\" found." echo "No merge request with source_branch = \"$BRANCH_TO_PULL\" found."
...@@ -188,7 +188,7 @@ ...@@ -188,7 +188,7 @@
for i in $(seq 0 $(($(jq length <<<$PIPELINES) - 1))); do for i in $(seq 0 $(($(jq length <<<$PIPELINES) - 1))); do
PIPELINE_ID=$(jq --argjson idx $i '.[$idx].id' <<<$PIPELINES) PIPELINE_ID=$(jq --argjson idx $i '.[$idx].id' <<<$PIPELINES)
echo "Current pipeline ID : $PIPELINE_ID" 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") JOBS=$(curl -s "$DEP_API_URL/pipelines/$PIPELINE_ID/jobs")
if [[ $(jq -r '.message' <<<$JOBS) == "404 Not found" ]]; then if [[ $(jq -r '.message' <<<$JOBS) == "404 Not found" ]]; then
echo "WARNING: NO JOBS FOUND FOR PIPELINE $PIPELINE_ID OF PROJECT $DEP_NAME." echo "WARNING: NO JOBS FOUND FOR PIPELINE $PIPELINE_ID OF PROJECT $DEP_NAME."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment