use toolkit component for ensure-job-added

This commit is contained in:
Duncan Macleod 2024-09-25 15:45:33 +02:00
parent 586d546db3
commit 1627993727
No known key found for this signature in database

View file

@ -3,23 +3,12 @@ include:
inputs:
run_advanced_sast: true
stages: [test, release]
- component: $CI_SERVER_FQDN/components/toolkit/ensure-job-added@main
inputs:
job_name: gitlab-advanced-sast
exact: true
ensure-job-added:
parallel:
matrix:
- JOB_NAME:
- gitlab-advanced-sast
image: badouralix/curl-jq
script:
- |
route="$CI_API_V4_URL/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs"
count=`curl --silent $route | jq "map(select(.name | contains(\"$JOB_NAME\"))) | length"`
if [ "$count" != "1" ]; then
exit 1
fi
rules:
- if: $CI_COMMIT_BRANCH && $CI_SERVER_HOST =~ /gitlab.com/
stages: [test, release]
# Ensure that a project description exists, because it will be important to display
# the resource in the catalog.