Update README.md on how to disable secret-detection job

This commit is contained in:
Ahmed Hemdan 2023-06-27 16:06:50 +02:00
parent 66e7f4df74
commit d69665fd97
No known key found for this signature in database
GPG key ID: 35C579218532E2FF

View file

@ -18,13 +18,21 @@ include:
where `<VERSION>` is the latest released tag or `main`.
If you want to leverage the `$SECRET_DETECTION_DISABLED` variable to run the `secret_detection` job conditionally use `include:rules`. Otherwise the job will run when applicable:
If you want to leverage the `$SECRET_DETECTION_DISABLED` variable to run the `secret_detection` job conditionally use `include:rules` with `when: never`. Otherwise the job will run when applicable:
```yaml
include:
- component: gitlab.com/gitlab-components/secret-detection@main
rules:
- if: $SECRET_DETECTION_DISABLED != "true"
- if: $SECRET_DETECTION_DISABLED == "true" || $SECRET_DETECTION_DISABLED == "1"
when: never
```
This assumes `SECRET_DETECTION_DISABLED` variable is already defined in `.gitlab-ci.yml` with either `'true'` or `'1'` as the value:
```yaml
variables:
SECRET_DETECTION_DISABLED: 'true'
```
### Inputs