Commit 0933a37f authored by Suzanne Selhorn's avatar Suzanne Selhorn

Merge branch 'docs-rules-when' into 'master'

Update `when` details for `rules`

See merge request gitlab-org/gitlab!36017
parents 995919b3 03564450
...@@ -1088,7 +1088,7 @@ The job attributes allowed by `rules` are: ...@@ -1088,7 +1088,7 @@ The job attributes allowed by `rules` are:
- If used as `when: delayed`, `start_in` is also required. - If used as `when: delayed`, `start_in` is also required.
- [`allow_failure`](#allow_failure): If not defined, defaults to `allow_failure: false`. - [`allow_failure`](#allow_failure): If not defined, defaults to `allow_failure: false`.
If `when` is evaluated to any value except `never`, the job is included in the pipeline. If a rule evaluates to true, and `when` has any value except `never`, the job is included in the pipeline.
For example: For example:
...@@ -1189,10 +1189,11 @@ for more details. ...@@ -1189,10 +1189,11 @@ for more details.
#### Differences between `rules` and `only`/`except` #### Differences between `rules` and `only`/`except`
A very important difference between `rules` and `only/except`, is that jobs defined Jobs defined with `only/except` do not trigger merge request pipelines by default.
with `only/except` do not trigger merge request pipelines without explicit configuration. You must explicitly add `only: merge_requests`.
`rules` *can* trigger all types of pipelines, without explicitly configuring each
type. Jobs defined with `rules` can trigger all types of pipelines.
You do not have to explicitly configure each type.
For example: For example:
...@@ -1259,6 +1260,8 @@ Some details regarding the logic that determines the `when` for the job: ...@@ -1259,6 +1260,8 @@ Some details regarding the logic that determines the `when` for the job:
rule without `if` or `changes`, always matches, and is always used if reached. rule without `if` or `changes`, always matches, and is always used if reached.
- If a rule matches and has no `when` defined, the rule uses the `when` - If a rule matches and has no `when` defined, the rule uses the `when`
defined for the job, which defaults to `on_success` if not defined. defined for the job, which defaults to `on_success` if not defined.
- You can define `when` once per rule, or once at the job-level, which applies to
all rules. You can't mix `when` at the job-level with `when` in rules.
For behavior similar to the [`only`/`except` keywords](#onlyexcept-basic), you can For behavior similar to the [`only`/`except` keywords](#onlyexcept-basic), you can
check the value of the `$CI_PIPELINE_SOURCE` variable. check the value of the `$CI_PIPELINE_SOURCE` variable.
......
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