Update README.md on how to disable sast jobs

This commit is contained in:
Ahmed Hemdan 2023-06-27 19:08:38 +02:00
parent 999bd9d0c2
commit fe3758e949
No known key found for this signature in database
GPG key ID: 35C579218532E2FF

View file

@ -17,14 +17,20 @@ include:
where `<VERSION>` is the latest released tag or `main`. where `<VERSION>` is the latest released tag or `main`.
If you want to leverage the `$SAST_DISABLED` variable to define or not the jobs conditionally use `include:rules`. If you want to leverage the `$SAST_DISABLED` variable to run the jobs conditionally use `include:rules` with `when: never`. Otherwise all SAST jobs will always run when applicable:
Otherwise all SAST jobs will always run when applicable:
```yaml ```yaml
include: include:
- component: gitlab.com/gitlab-components/sast@main - component: gitlab.com/gitlab-components/sast@main
rules: rules:
- if: $SAST_DISABLED != "true" - if: $SAST_DISABLED == "true" || $SAST_DISABLED == "1"
```
This assumes `SAST_DISABLED` variable is already defined in `.gitlab-ci.yml` with either `'true'` or `'1'` as the value:
```yaml
variables:
SAST_DISABLED: 'true'
``` ```
### Inputs ### Inputs