mirror of
https://gitlab.com/components/secret-detection.git
synced 2025-06-30 07:28:30 +02:00
Add an initial version of the component
This commit is contained in:
parent
5d254b062d
commit
66e7f4df74
18 changed files with 307 additions and 78 deletions
49
.gitlab-ci.yml
Normal file
49
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,49 @@
|
|||
include:
|
||||
component: gitlab.com/$CI_PROJECT_PATH@$CI_COMMIT_SHA
|
||||
|
||||
stages: [test, release]
|
||||
|
||||
ensure-job-added:
|
||||
stage: test
|
||||
image: badouralix/curl-jq
|
||||
script:
|
||||
- echo "Expect that a job named 'secret_detection' is added to the pipeline"
|
||||
- |
|
||||
route="https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs"
|
||||
count=`curl --silent $route | jq 'map(select(.name | contains("secret_detection"))) | length'`
|
||||
if [ "$count" != "1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 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="https://gitlab.com/api/v4/projects/$CI_PROJECT_ID"
|
||||
desc=`curl --silent $route | jq '.description'`
|
||||
if [ "$desc" = "null" ]; then
|
||||
echo "Description not set. Please set a projet description"
|
||||
exit 1
|
||||
else
|
||||
echo "Description set"
|
||||
fi
|
||||
|
||||
# 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"
|
Loading…
Add table
Add a link
Reference in a new issue