From 2cf170906aeacea3e3eff826fc0f4ed300b20caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20KUBLER?= <gregoire.kubler@proton.me> Date: Thu, 21 Mar 2024 11:58:40 +0100 Subject: [PATCH] chore : changed token to CI_JOB_TOKEN --- .gitlab/ci/build.gitlab-ci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitlab/ci/build.gitlab-ci.yml b/.gitlab/ci/build.gitlab-ci.yml index 57b97609..6a1d924f 100644 --- a/.gitlab/ci/build.gitlab-ci.yml +++ b/.gitlab/ci/build.gitlab-ci.yml @@ -43,12 +43,10 @@ build:ubuntu_cpp: echo "Retrieving build_artifacts from hrouis' forked project." USER_ID=17216 - echo "command : curl'https://gitlab.eclipse.org/api/v4/users/${USER_ID}/projects?search=${DEPENDENCY_NAME}'" + # Retrieve $DEPENDENCY_JOB from latest pipeline of $BRANCH_TO_PULL, independant from its success or failure 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') - - # Retrieve latest pipeline of given branch, independant from its success or failure - PIPELINE_ID=$(curl --header "PRIVATE_TOKEN: 926V98hnCwny2sqQQzGc" "https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/pipelines?ref=${BRANCH_TO_PULL}&order_by=updated_at&sort=desc" | jq -r ".[0].id") - JOB_ID=$(curl --header "PRIVATE_TOKEN: 926V98hnCwny2sqQQzGc" "https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/pipelines/$PIPELINE_ID/jobs" | jq --arg job_name "$DEPENDENCY_JOB" 'map(select(.name == $job_name)) | .[0].id') + PIPELINE_ID=$(curl --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" | jq -r ".[0].id") + JOB_ID=$(curl --header "PRIVATE_TOKEN: $CI_JOB_TOKEN" "https://gitlab.eclipse.org/api/v4/projects/$DEPENDENCY_ID/pipelines/$PIPELINE_ID/jobs" | jq --arg job_name "$DEPENDENCY_JOB" 'map(select(.name == $job_name)) | .[0].id') 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 -- GitLab