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

Fix legacy shared script fix

parent f1554d02
No related branches found
No related tags found
1 merge request!12Fix legacy shared script fix
......@@ -42,31 +42,33 @@
fi
# Retrieve latest successful $DEPENDENCY_JOB from $BRANCH_TO_PULL
- PIPELINES=$(curl -s "${API_URL}/projects/$DEPENDENCY_ID/pipelines?ref=${BRANCH_TO_PULL}&order_by=updated_at&sort=desc")
- PIPELINES=$(curl -s "$API_URL/projects/$DEPENDENCY_ID/pipelines?ref=$BRANCH_TO_PULL&order_by=updated_at&sort=desc")
- JOB_ID=-1
# handle case where there is no branch with the same name
- >
for i in $(seq 0 $(jq length <<< "$PIPELINES")); do
for i in $(seq 0 $(($(jq length <<<$PIPELINES) - 1))); do
PIPELINE_ID=$(jq --argjson idx $i '.[$idx].id' <<< $PIPELINES)
JOBS=$(curl -s "${API_URL}/projects/$DEPENDENCY_ID/pipelines/$PIPELINE_ID/jobs" | jq --arg job_name "$DEPENDENCY_JOB" 'map(select((.name == $job_name) and (.status == "success")))')
JOBS=$(curl -s "${API_URL}/projects/$DEPENDENCY_ID/pipelines/$PIPELINE_ID/jobs")
echo "looking for successful $DEPENDENCY_JOB in PIPELINE $PIPELINE_ID"
JOBS=$(jq --arg job_name "$DEPENDENCY_JOB" 'map(select((.name == $job_name) and (.status == "success")))' <<< $JOBS)
if [[ $(jq '. | length' <<< $JOBS) > 0 ]]; then
JOB_ID=$(jq '.[0].id' <<< $JOBS)
break
fi
done
- >
if( $JOB_ID == -1 ) ; then
if [[ "$JOB_ID" == "-1" ]] ; then
echo "ERROR : no successful job \"$DEPENDENCY_JOB\" found in branch \"$BRANCH_TO_PULL\" for project \"$DEPENDENCY_NAME\""
else
echo "Successful job \"$DEPENDENCY_JOB\" found in branch \"$BRANCH_TO_PULL\" for project \"$DEPENDENCY_NAME\""
exit
fi
- echo "Successful job \"$DEPENDENCY_JOB\" found in branch \"$BRANCH_TO_PULL\" for project \"$DEPENDENCY_NAME\""
- echo "curling from \"${API_URL}/projects/$DEPENDENCY_ID/jobs/$JOB_ID/artifacts\""
- curl --location --output build_artifacts.zip "${API_URL}/projects/$DEPENDENCY_ID/jobs/$JOB_ID/artifacts"
- unzip -q -o build_artifacts.zip -d .
- rm -rf build_cpp
- set +x
.download_dependency_windows:
# Note:
# For this script to work you need to define teh following variables
......
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