sast/.gitlab-ci.yml
2024-10-01 14:29:25 +01:00

46 lines
1.5 KiB
YAML

include:
- component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/sast@$CI_COMMIT_SHA
inputs:
run_advanced_sast: true
- component: $CI_SERVER_FQDN/components/toolkit/ensure-job-added@main
inputs:
job_name: gitlab-advanced-sast
exact: true
stages: [test, release]
# Ensure that a project description exists, because it will be important to display
# the resource in the catalog.
check-description:
image: badouralix/curl-jq
script:
- |
route="$CI_API_V4_URL/projects/$CI_PROJECT_ID"
desc=`curl --silent $route | jq '.description'`
if [ "$desc" = "null" ]; then
echo "Description not set. Please set a project description"
exit 1
else
echo "Description set"
fi
rules:
- if: $CI_SERVER_HOST =~ /gitlab.com/
# Ensure that a `README.md` exists in the root directory as it represents the
# documentation for the whole components repository.
check-readme:
image: busybox
script: ls README.md || (echo "Please add a README.md file" && exit 1)
# If we are tagging a release with a specific convention ("v" + number) and all
# previous checks succeeded, we proceed with creating a release automatically.
create-release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG =~ /\d+/
script: echo "Creating release $CI_COMMIT_TAG"
release:
tag_name: $CI_COMMIT_TAG
description: "Release $CI_COMMIT_TAG of components repository $CI_PROJECT_PATH"