From 5fba8ae159daa646bfeddf660b99c7a8cb4d7024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20KUBLER?= <gregoire.kubler@proton.me> Date: Thu, 21 Mar 2024 16:23:19 +0100 Subject: [PATCH] fix : syntax --- .gitlab/ci/build.gitlab-ci.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitlab/ci/build.gitlab-ci.yml b/.gitlab/ci/build.gitlab-ci.yml index 48d49150..797fd3f7 100644 --- a/.gitlab/ci/build.gitlab-ci.yml +++ b/.gitlab/ci/build.gitlab-ci.yml @@ -45,10 +45,11 @@ build:ubuntu_cpp: DEPENDENCY_ID=$(curl --header "PRIVATE_TOKEN: $CI_JOB_TOKEN" "https://gitlab.eclipse.org/api/v4/users/${USER_ID}/projects?search=${DEPENDENCY_NAME}" | jq -r '.[0].id') fi - # Retrieve latest successful $DEPENDENCY_JOB $BRANCH_TO_PULL - PIPELINES=$(curl -s --header "PRIVATE_TOKEN: $CI_JOB_TOKEN" "https://gitlab.eclipse.org/api/v4/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 + # Retrieve latest successful $DEPENDENCY_JOB $BRANCH_TO_PULL + - PIPELINES=$(curl -s --header "PRIVATE_TOKEN:$CI_JOB_TOKEN" "https://gitlab.eclipse.org/api/v4/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 PIPELINE_ID=$(jq --argjson idx $i '.[$idx].id' <<< $PIPELINES) @@ -58,14 +59,15 @@ build:ubuntu_cpp: break fi done + - > 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\"" fi - echo "curling from \"https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/jobs/$JOB_ID/artifacts\"" - curl --location --output build_artifacts.zip --header "PRIVATE_TOKEN: $CI_JOB_TOKEN" "https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/jobs/$JOB_ID/artifacts" + - echo "curling from \"https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/jobs/$JOB_ID/artifacts\"" + - curl --location --output build_artifacts.zip --header "PRIVATE_TOKEN: $CI_JOB_TOKEN" "https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/jobs/$JOB_ID/artifacts" - set +x - unzip -q -o build_artifacts.zip -d . -- GitLab