From c9f91044c03a131a06181c3b7e837b49e25697ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20KUBLER?= <gregoire.kubler@proton.me> Date: Fri, 22 Mar 2024 11:57:56 +0100 Subject: [PATCH] feat : removed hard coded hrouis' user ID and user name --- .gitlab/ci/build.gitlab-ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitlab/ci/build.gitlab-ci.yml b/.gitlab/ci/build.gitlab-ci.yml index 463a35e6..067dcfd3 100644 --- a/.gitlab/ci/build.gitlab-ci.yml +++ b/.gitlab/ci/build.gitlab-ci.yml @@ -27,10 +27,10 @@ build:ubuntu_cpp: fi else # CASE CASUAL COMMIT # checking if given branch exist on official repo or on fork - if [[ $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/eclipse/aidge/$DEPENDENCY_NAME/-/tree/$CI_COMMIT_REF_NAME") -ne 302 && $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/eclipse/aidge/$DEPENDENCY_NAME/-/tree/$CI_COMMIT_REF_NAME") -ne 404 ]]; then + if [[ $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/eclipse/${CI_PROJECT_NAMESPACE}/$DEPENDENCY_NAME/-/tree/$CI_COMMIT_REF_NAME") -ne 302 && $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/eclipse/${CI_PROJECT_NAMESPACE}/$DEPENDENCY_NAME/-/tree/$CI_COMMIT_REF_NAME") -ne 404 ]]; then PULL_FROM_FORK=FALSE BRANCH_TO_PULL=$CI_COMMIT_REF_NAME - elif [[ $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/hrouis/$DEPENDENCY_NAME/-/tree/$CI_COMMIT_REF_NAME") -ne 302 && $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/hrouis/$DEPENDENCY_NAME/-/tree/$CI_COMMIT_REF_NAME") -ne 302 ]]; then + elif [[ $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/${CI_PROJECT_NAMESPACE}/$DEPENDENCY_NAME/-/tree/$CI_COMMIT_REF_NAME") -ne 302 && $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/${CI_PROJECT_NAMESPACE}/$DEPENDENCY_NAME/-/tree/$CI_COMMIT_REF_NAME") -ne 302 ]]; then PULL_FROM_FORK=TRUE BRANCH_TO_PULL=$CI_COMMIT_REF_NAME else @@ -43,9 +43,8 @@ build:ubuntu_cpp: if [[ ! $PULL_FROM_FORK ]]; then # nominal case : we are in the official project DEPENDENCY_ID=$(curl "https://gitlab.eclipse.org/api/v4/groups/${CI_PROJECT_NAMESPACE_ID}/projects?search=${DEPENDENCY_NAME}" | jq -r '.[0].id') else # case for fork - echo "Retrieving build_artifacts from hrouis' forked project." - USER_ID=17216 - 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') + echo "Retrieving build_artifacts from user' forked project." + DEPENDENCY_ID=$(curl --header "PRIVATE_TOKEN: $CI_JOB_TOKEN" "https://gitlab.eclipse.org/api/v4/users/${CI_PROJECT_NAMESPACE_ID}/projects?search=${DEPENDENCY_NAME}" | jq -r '.[0].id') fi # Retrieve latest successful $DEPENDENCY_JOB $BRANCH_TO_PULL -- GitLab