Commit cc3f2ff1 authored by Vijay Pandian's avatar Vijay Pandian

Adding yaml examples for only and except keywords

parent 75967a55
......@@ -605,6 +605,20 @@ With `only`, individual keys are logically joined by an AND:
> (any of refs) AND (any of variables) AND (any of changes) AND (if Kubernetes is active)
In the example below, the `test` job will `only` be created when the pipeline has been [scheduled](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/user/project/pipelines/schedules.md) or runs for `master` *AND* the `variables` keyword matches *AND* when the `kubernetes` service is active on the project.
```
test:
script: npm run test
only:
refs:
- master
- schedules
variables:
- $CI_COMMIT_MESSAGE =~ /run-end-to-end-tests/
kubernetes: active
```
`except` is implemented as a negation of this complete expression:
> NOT((any of refs) AND (any of variables) AND (any of changes) AND (if Kubernetes is active))
......@@ -613,6 +627,18 @@ This means the keys are treated as if joined by an OR. This relationship could b
> (any of refs) OR (any of variables) OR (any of changes) OR (if Kubernetes is active)
In the example below, the `test` job will **not** be created when the pipeline runs for the `master` *OR* if there are changes to the README.md file in the root directory of the repo.
```
test:
script: npm run test
except:
refs:
- master
changes:
- "README.md"
```
#### `only:refs`/`except:refs`
> `refs` policy introduced in GitLab 10.0.
......
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