前言
这是一个用于Gitlab的.gitlab-ci.yml流水线文件。将这个流水线文件放置在项目根目录中,并推送到gitlab实例中。如果gitlab实例上有docker类型的执行器,那么gitlab将会启用runner对该项目进行SAST安全检查以及密钥泄露检查。
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
when: always
- if: '$CI_PIPELINE_SOURCE == "push"'
when: always
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: always
- if: '$CI_COMMIT_TAG'
when: always
- when: never
stages:
- test
- secret-detection
include:
- template: Security/SAST.gitlab-ci.yml
- template: Security/Secret-Detection.gitlab-ci.yml
sast:
stage: test
secret_detection:
stage: secret-detection

添加后,推送到gitlab,运行截图如上。