Skip to content
Snippets Groups Projects
Commit 6acd6b34 authored by Lene Wasskog's avatar Lene Wasskog
Browse files

chore: Script for model verification

parent e75c6005
No related branches found
No related tags found
No related merge requests found
...@@ -145,12 +145,12 @@ deploy-release: ...@@ -145,12 +145,12 @@ deploy-release:
# which builds model with the new version of VIPSCommon. This pipeline fails if model build fails. # which builds model with the new version of VIPSCommon. This pipeline fails if model build fails.
verify_model_ALTERNARIA: verify_model_ALTERNARIA:
image: registry.gitlab.com/finestructure/pipeline-trigger image: eclipse-temurin:17.0.9_9-jdk-jammy
stage: models-1 stage: models-1
before_script: [] before_script:
- apt-get update && apt-get install -y jq curl
script: script:
- echo "trigger -h gitlab.nibio.no -a [MASKED] -p [MASKED] -t $MAIN_BRANCH $ALTERNARIA_PROJECT_ID -e VERSION=$VERSION -e PURPOSE=\"verify\"" - ./trigger_model_verification.sh "$ALTERNARIA_PROJECT_ID" "$MAIN_BRANCH" "$VERSION" "verify"
- trigger -h gitlab.nibio.no -a "$CICD_API_TOKEN" -p "$ACCESS_TOKEN_ALTERNARIA" -t $MAIN_BRANCH $ALTERNARIA_PROJECT_ID -e VERSION=$VERSION -e PURPOSE="verify"
tags: tags:
- java - java
dependencies: dependencies:
......
#!/bin/bash
set -euo pipefail
echo "Triggering ALTERNARIA verification pipeline via API..."
curl --fail --silent --show-error --request POST \
--header "JOB-TOKEN: $CI_JOB_TOKEN" \
--form ref="${MAIN_BRANCH}" \
--form "variables[VERSION]=${VERSION}" \
--form "variables[PURPOSE]=verify" \
"https://gitlab.juba.no/api/v4/projects/${ALTERNARIA_PROJECT_ID}/trigger/pipeline"
#!/bin/bash
set -euo pipefail
# Usage:
# ./trigger_model_verification.sh <project_id> <ref> <version> <purpose>
PROJECT_ID="$1"
REF="$2"
VERSION="$3"
PURPOSE="$4"
API_URL="https://gitlab.nibio.no/api/v4"
echo "Triggering pipeline for project $PROJECT_ID on ref '$REF'..."
# Trigger the pipeline
PIPELINE_JSON=$(curl --fail --silent --show-error --request POST \
--header "JOB-TOKEN: $CI_JOB_TOKEN" \
--form ref="$REF" \
--form "variables[VERSION]=$VERSION" \
--form "variables[PURPOSE]=$PURPOSE" \
"$API_URL/projects/${PROJECT_ID}/trigger/pipeline")
# Extract pipeline ID
PIPELINE_ID=$(echo "$PIPELINE_JSON" | jq -r '.id')
if [[ -z "$PIPELINE_ID" || "$PIPELINE_ID" == "null" ]]; then
echo "❌ Failed to get pipeline ID from response."
echo "$PIPELINE_JSON"
exit 1
fi
echo "✅ Pipeline triggered: ID=$PIPELINE_ID"
echo "🔄 Waiting for pipeline to complete..."
# Poll for status
while true; do
STATUS=$(curl --fail --silent --header "JOB-TOKEN: $CI_JOB_TOKEN" \
"$API_URL/projects/${PROJECT_ID}/pipelines/${PIPELINE_ID}" | jq -r '.status')
echo "🔍 Status: $STATUS"
case "$STATUS" in
success)
echo "✅ Downstream pipeline succeeded."
exit 0
;;
failed|canceled|skipped|manual)
echo "❌ Downstream pipeline ended with status: $STATUS"
exit 1
;;
running|pending)
sleep 5
;;
*)
echo "⚠️ Unexpected status: $STATUS"
exit 1
;;
esac
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment