Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSCommon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
VIPSCommon
Commits
6acd6b34
Commit
6acd6b34
authored
1 month ago
by
Lene Wasskog
Browse files
Options
Downloads
Patches
Plain Diff
chore: Script for model verification
parent
e75c6005
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+4
-4
4 additions, 4 deletions
.gitlab-ci.yml
trigger_model_verification.sh
+72
-0
72 additions, 0 deletions
trigger_model_verification.sh
with
76 additions
and
4 deletions
.gitlab-ci.yml
+
4
−
4
View file @
6acd6b34
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
trigger_model_verification.sh
0 → 100755
+
72
−
0
View file @
6acd6b34
#!/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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment