Commit a1c1c25f authored by Marcel Amirault's avatar Marcel Amirault

Merge branch 'patch-180' into 'master'

Better organize how to use workflow:rules

See merge request gitlab-org/gitlab!36008
parents 67bcb28c ed44cb55
......@@ -298,6 +298,26 @@ determine whether or not a pipeline is created. It currently accepts a single
`rules:` key that operates similarly to [`rules:` defined within jobs](#rules),
enabling dynamic configuration of the pipeline.
If you are new to GitLab CI/CD and `workflow: rules`, you may find the [`workflow:rules` templates](#workflowrules-templates) useful.
To define your own `workflow: rules`, the configuration options currently available are:
- [`if`](#rulesif): Define a rule.
- [`when`](#when): May be set to `always` or `never` only. If not provided, the default value is `always`​.
The list of `if` rules is evaluated until a single one is matched. If none
match, the last `when` will be used:
```yaml
workflow:
rules:
- if: $CI_COMMIT_REF_NAME =~ /-wip$/
when: never
- if: $CI_COMMIT_TAG
when: never
- when: always
```
#### `workflow:rules` templates
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/217732) in GitLab 13.0.
......@@ -335,24 +355,6 @@ include:
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
```
If you prefer to define your own rules, the configuration options currently available are:​
- [`if`](#rulesif): Define a rule.
- [`when`](#when): May be set to `always` or `never` only. If not provided, the default value is `always`​.
The list of `if` rules is evaluated until a single one is matched. If none
match, the last `when` will be used:
```yaml
workflow:
rules:
- if: $CI_COMMIT_REF_NAME =~ /-wip$/
when: never
- if: $CI_COMMIT_TAG
when: never
- when: always
```
### `include`
> - Introduced in [GitLab Premium](https://about.gitlab.com/pricing/) 10.5.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment