Skip to content

Commit 33dea6d

Browse files
committed
CI: Update gitlab CTA trigger job to use new CTA pipeline setup
1 parent 432e2ff commit 33dea6d

1 file changed

Lines changed: 63 additions & 37 deletions

File tree

.gitlab-ci.yml

Lines changed: 63 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -850,46 +850,72 @@ email_notification:
850850
notify_cta_project:
851851
stage: publish
852852
image: gitlab-registry.cern.ch/linuxsupport/alma9-base
853+
needs:
854+
- job: el9_docker_image
855+
artifacts: false
856+
variables:
857+
CTA_BRANCH: main
853858
script:
859+
- dnf install --nogpg -y curl gawk jq
860+
- CTA_PROJECT_ID="139306"
861+
- CTA_PROJECT_API="https://gitlab.cern.ch/api/v4/projects/$CTA_PROJECT_ID"
862+
- TRIGGER_URL="$CTA_PROJECT_API/trigger/pipeline"
863+
# Construct EOS versions
854864
- |
855-
dnf install --nogpg -y git curl gawk jq
856-
# Variables
857-
EOS_TAG_NAME=$(git describe --tags --exact-match || echo "not-a-tag")
858-
CTA_PROJECT_ID="139306"
859-
CTA_PROJECT_API="https://gitlab.cern.ch/api/v4/projects/$CTA_PROJECT_ID"
860-
TRIGGER_URL="$CTA_PROJECT_API/trigger/pipeline"
861-
862-
# Extract versions from eos.spec.in
863-
XROOTD_VERSION=$(grep '^%define xrootd_version_min' eos.spec.in | awk '{print $3}')
864-
865-
# Fetch the latest tag from the CTA project
866-
LATEST_CTA_TAG=$(curl --silent "$CTA_PROJECT_API/repository/tags?order_by=updated&sort=desc" | jq -r '.[0].name')
867-
echo "Latest tag from the CTA project: $LATEST_CTA_TAG"
868-
869-
if [ "$EOS_TAG_NAME" != "not-a-tag" ]; then
870-
# Trigger the external CTA pipeline using the latest CTA and EOS tags
871-
curl -X POST \
872-
-F token=$CTA_TRIGGER_TOKEN \
873-
-F ref=main \
874-
-F "variables[CUSTOM_EOS_TAG]=$EOS_TAG_NAME" \
875-
-F "variables[CUSTOM_XRD_TAG]=$XROOTD_VERSION" \
876-
-F "variables[CUSTOM_CTA_TAG]=$LATEST_CTA_TAG" \
877-
-F "variables[PIPELINE_TYPE]=EOS_REGR_AGAINST_CTA_TAG" \
878-
$TRIGGER_URL
879-
880-
# Trigger the external CTA pipeline using the latest EOS tag a
881-
# and latest CTA commit to main
882-
curl -X POST \
883-
-F token=$CTA_TRIGGER_TOKEN \
884-
-F ref=main \
885-
-F "variables[CUSTOM_EOS_TAG]=$EOS_TAG_NAME" \
886-
-F "variables[CUSTOM_XRD_TAG]=$XROOTD_VERSION" \
887-
-F "variables[PIPELINE_TYPE]=EOS_REGR_AGAINST_CTA_MAIN" \
888-
$TRIGGER_URL
865+
if [[ -z "$CI_COMMIT_TAG" ]]; then
866+
EOS_IMAGE_TAG="$CI_COMMIT_SHORT_SHA.el9";
867+
else
868+
EOS_IMAGE_TAG="$CI_COMMIT_TAG.el9";
869+
EOS_VERSION="$CI_COMMIT_TAG";
889870
fi
890-
when: manual
891-
#only:
892-
# - tags
871+
# Extract XRootD version from eos.spec.in
872+
- XROOTD_VERSION=$(grep '^%define xrootd_version_min' eos.spec.in | awk '{print $3}')
873+
# The locked XRootD version does not have the release included, while this is necessary to versionlock it correctly in the CTA pipeline
874+
- |
875+
if [[ "$XROOTD_VERSION" != *-* ]]; then
876+
XROOTD_VERSION="${XROOTD_VERSION}-1"
877+
fi
878+
# Get the latest stable CTA version
879+
- LATEST_CTA_VERSION=$(dnf -q --repofrompath=temprepo,https://cta-public-repo.web.cern.ch/stable/cta-5/el9/cta/x86_64/ --repo=temprepo repoquery --latest-limit=1 --qf "%{version}-%{release}" cta-taped)
880+
# Against an existing CTA tag, we can only trigger a pipeline where a different EOS image is used
881+
- echo "Triggering pipeline against CTA version $LATEST_CTA_VERSION with EOS image tag $EOS_IMAGE_TAG"
882+
- curl -X POST
883+
-F token=$CTA_TRIGGER_TOKEN
884+
-F ref=$CTA_BRANCH
885+
-F "variables[CUSTOM_EOS_IMAGE_TAG]=$EOS_IMAGE_TAG"
886+
-F "variables[CUSTOM_CTA_VERSION]=$LATEST_CTA_VERSION"
887+
-F "variables[PIPELINE_TYPE]=REGR_AGAINST_CTA_VERSION"
888+
$TRIGGER_URL
889+
# Against the CTA main branch, we can also test the client EOS and XRootD versions if we are on a (EOS) tag
890+
# If we are not on a (EOS) tag, the EOS RPMs are not accessible by the CTA pipeline, so we only test against the image
891+
- |
892+
if [[ -z "$CI_COMMIT_TAG" ]]; then
893+
echo "Triggering pipeline against CTA main branch"
894+
echo "Using EOS image tag $EOS_IMAGE_TAG and XRootD version $XROOTD_VERSION"
895+
curl -X POST \
896+
-F token=$CTA_TRIGGER_TOKEN \
897+
-F ref=$CTA_BRANCH \
898+
-F "variables[CUSTOM_EOS_IMAGE_TAG]=$EOS_IMAGE_TAG" \
899+
-F "variables[CUSTOM_XROOTD_VERSION]=$XROOTD_VERSION" \
900+
-F "variables[PIPELINE_TYPE]=REGR_AGAINST_CTA_MAIN" \
901+
$TRIGGER_URL
902+
else
903+
echo "Triggering pipeline against CTA main branch"
904+
echo "Using EOS image tag $EOS_IMAGE_TAG, EOS client version $EOS_VERSION and XRootD version $XROOTD_VERSION"
905+
curl -X POST \
906+
-F token=$CTA_TRIGGER_TOKEN \
907+
-F ref=$CTA_BRANCH \
908+
-F "variables[CUSTOM_EOS_IMAGE_TAG]=$EOS_IMAGE_TAG" \
909+
-F "variables[CUSTOM_EOS_VERSION]=$EOS_VERSION" \
910+
-F "variables[CUSTOM_XROOTD_VERSION]=$XROOTD_VERSION" \
911+
-F "variables[PIPELINE_TYPE]=REGR_AGAINST_CTA_MAIN" \
912+
$TRIGGER_URL
913+
fi
914+
rules:
915+
- if: '$CI_COMMIT_TAG'
916+
when: on_success
917+
- when: manual
918+
allow_failure: true
893919

894920
rpm_commit_artifacts:
895921
stage: publish

0 commit comments

Comments
 (0)