debian-mirror-gitlab/lib/gitlab/ci/templates/Security/Secret-Detection.gitlab-ci.yml

41 lines
1.4 KiB
YAML
Raw Normal View History

2020-06-23 00:09:42 +05:30
# Read more about this feature here: https://docs.gitlab.com/ee/user/application_security/secret_detection
#
# Configure the scanning tool through the environment variables.
# List of the variables: https://gitlab.com/gitlab-org/security-products/secret_detection#available-variables
# How to set: https://docs.gitlab.com/ee/ci/yaml/#variables
variables:
SECURE_ANALYZERS_PREFIX: "registry.gitlab.com/gitlab-org/security-products/analyzers"
SECRETS_ANALYZER_VERSION: "3"
2020-10-24 23:57:45 +05:30
SECRET_DETECTION_EXCLUDED_PATHS: ""
2020-06-23 00:09:42 +05:30
2020-07-28 23:09:34 +05:30
.secret-analyzer:
2020-06-23 00:09:42 +05:30
stage: test
image: "$SECURE_ANALYZERS_PREFIX/secrets:$SECRETS_ANALYZER_VERSION"
services: []
artifacts:
reports:
secret_detection: gl-secret-detection-report.json
2020-07-28 23:09:34 +05:30
secret_detection_default_branch:
extends: .secret-analyzer
rules:
- if: $SECRET_DETECTION_DISABLED
when: never
2020-10-24 23:57:45 +05:30
- if: $CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH
2020-07-28 23:09:34 +05:30
script:
- /analyzer run
secret_detection:
extends: .secret-analyzer
rules:
- if: $SECRET_DETECTION_DISABLED
when: never
2020-10-24 23:57:45 +05:30
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
2020-06-23 00:09:42 +05:30
script:
2020-07-28 23:09:34 +05:30
- git fetch origin $CI_DEFAULT_BRANCH $CI_BUILD_REF_NAME
- export SECRET_DETECTION_COMMIT_TO=$(git log --left-right --cherry-pick --pretty=format:"%H" refs/remotes/origin/$CI_DEFAULT_BRANCH...refs/remotes/origin/$CI_BUILD_REF_NAME | tail -n 1)
- export SECRET_DETECTION_COMMIT_FROM=$CI_COMMIT_SHA
2020-06-23 00:09:42 +05:30
- /analyzer run