Commit 8b62d092 authored by Russell Dickenson's avatar Russell Dickenson

Merge branch 'docs-remove-empty-branch-pipeline-details' into 'master'

Remove details about empty branch pipelines

See merge request gitlab-org/gitlab!39661
parents 841dae37 1e2da03f
...@@ -314,7 +314,6 @@ the [common `if` clauses for `rules`](#common-if-clauses-for-rules) for more exa ...@@ -314,7 +314,6 @@ the [common `if` clauses for `rules`](#common-if-clauses-for-rules) for more exa
| `if: '$CI_PIPELINE_SOURCE == "push"'` | Control when both branch pipelines and tag pipelines run. | | `if: '$CI_PIPELINE_SOURCE == "push"'` | Control when both branch pipelines and tag pipelines run. |
| `if: $CI_COMMIT_TAG` | Control when tag pipelines run. | | `if: $CI_COMMIT_TAG` | Control when tag pipelines run. |
| `if: $CI_COMMIT_BRANCH` | Control when branch pipelines run. | | `if: $CI_COMMIT_BRANCH` | Control when branch pipelines run. |
| `if: '$CI_COMMIT_BRANCH && $CI_COMMIT_BEFORE_SHA != "0000000000000000000000000000000000000000"'` | Control when pipelines run for new branches that are created or pushed with no commits. See the [skip job if branch is empty](#skip-job-if-branch-is-empty) example for more details. |
For example, with the following configuration, pipelines run for all `push` events (changes to For example, with the following configuration, pipelines run for all `push` events (changes to
branches and new tags) as long as they *don't* have `-wip` in the commit message. Scheduled branches and new tags) as long as they *don't* have `-wip` in the commit message. Scheduled
...@@ -1369,19 +1368,6 @@ Other commonly used variables for `if` clauses: ...@@ -1369,19 +1368,6 @@ Other commonly used variables for `if` clauses:
- `if: '$CUSTOM_VARIABLE == "value1"'`: If the custom variable `CUSTOM_VARIABLE` is - `if: '$CUSTOM_VARIABLE == "value1"'`: If the custom variable `CUSTOM_VARIABLE` is
exactly `value1`. exactly `value1`.
##### Skip job if branch is empty
A branch has no commits if the value of`$CI_COMMIT_BEFORE_SHA` is
`0000000000000000000000000000000000000000`. You can use this value to
avoid running a job on branches with no commits.
To run a job only on branches with commits:
```yaml
rules:
- if: '$CI_COMMIT_BRANCH && $CI_COMMIT_BEFORE_SHA != "0000000000000000000000000000000000000000"'
```
#### `rules:changes` #### `rules:changes`
To determine if jobs should be added to a pipeline, `rules: changes` clauses check To determine if jobs should be added to a pipeline, `rules: changes` clauses check
......
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