Merge branch 'docs/yaml-hidden-keys' into 'master'
Clarify yaml hidden keys (jobs) Closes #37480 See merge request !14110
This commit is contained in:
commit
782e04d2c9
|
@ -1366,25 +1366,31 @@ variables:
|
||||||
GIT_DEPTH: "3"
|
GIT_DEPTH: "3"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Hidden keys
|
## Hidden keys (jobs)
|
||||||
|
|
||||||
> Introduced in GitLab 8.6 and GitLab Runner v1.1.1.
|
> Introduced in GitLab 8.6 and GitLab Runner v1.1.1.
|
||||||
|
|
||||||
Keys that start with a dot (`.`) will be not processed by GitLab CI. You can
|
If you want to temporarily 'disable' a job, rather than commenting out all the
|
||||||
use this feature to ignore jobs, or use the
|
lines where the job is defined:
|
||||||
[special YAML features](#special-yaml-features) and transform the hidden keys
|
|
||||||
into templates.
|
|
||||||
|
|
||||||
In the following example, `.key_name` will be ignored:
|
```
|
||||||
|
#hidden_job:
|
||||||
```yaml
|
# script:
|
||||||
.key_name:
|
# - run test
|
||||||
script:
|
|
||||||
- rake spec
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Hidden keys can be hashes like normal CI jobs, but you are also allowed to use
|
you can instead start its name with a dot (`.`) and it will not be processed by
|
||||||
different types of structures to leverage special YAML features.
|
GitLab CI. In the following example, `.hidden_job` will be ignored:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
.hidden_job:
|
||||||
|
script:
|
||||||
|
- run test
|
||||||
|
```
|
||||||
|
|
||||||
|
Use this feature to ignore jobs, or use the
|
||||||
|
[special YAML features](#special-yaml-features) and transform the hidden keys
|
||||||
|
into templates.
|
||||||
|
|
||||||
## Special YAML features
|
## Special YAML features
|
||||||
|
|
||||||
|
@ -1400,7 +1406,7 @@ Read more about the various [YAML features](https://learnxinyminutes.com/docs/ya
|
||||||
|
|
||||||
YAML has a handy feature called 'anchors', which lets you easily duplicate
|
YAML has a handy feature called 'anchors', which lets you easily duplicate
|
||||||
content across your document. Anchors can be used to duplicate/inherit
|
content across your document. Anchors can be used to duplicate/inherit
|
||||||
properties, and is a perfect example to be used with [hidden keys](#hidden-keys)
|
properties, and is a perfect example to be used with [hidden keys](#hidden-keys-jobs)
|
||||||
to provide templates for your jobs.
|
to provide templates for your jobs.
|
||||||
|
|
||||||
The following example uses anchors and map merging. It will create two jobs,
|
The following example uses anchors and map merging. It will create two jobs,
|
||||||
|
|
Loading…
Reference in New Issue