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

chore : generalized DEP_API_URL call in ubuntu slect jobs

parent 5086c9e2
No related branches found
No related tags found
No related merge requests found
......@@ -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."
......
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