gitlabci
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| gitlabci [2022/09/22 15:59] – skipidar | gitlabci [2022/09/22 16:35] (current) – skipidar | ||
|---|---|---|---|
| Line 231: | Line 231: | ||
| - | === reuse properties with anchors | + | === <<: *my_anchor |
| Using anchors you can reuse attriburtes across jobs, | Using anchors you can reuse attriburtes across jobs, | ||
| especially from a disabled job: | especially from a disabled job: | ||
| Line 254: | Line 254: | ||
| + | === !reference [.terraform, | ||
| + | Reference some piece of code. | ||
| + | https:// | ||
| + | Use the !reference custom YAML tag to select keyword configuration from other job sections and reuse it in the current section. | ||
| + | |||
| + | Unlike YAML anchors, you can use `!reference` tags to reuse configuration from included configuration files as well. | ||
| + | |||
| + | |||
| + | setup.yml | ||
| + | |||
| + | <sxh yaml> | ||
| + | |||
| + | .setup: | ||
| + | script: | ||
| + | - echo creating environment | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | gitlab-ci.yml | ||
| + | <sxh yaml> | ||
| + | include: | ||
| + | - local: setup.yml | ||
| + | |||
| + | .teardown: | ||
| + | after_script: | ||
| + | - echo deleting environment | ||
| + | |||
| + | |||
| + | test: | ||
| + | script: | ||
| + | - !reference [.setup, script] | ||
| + | - echo running my own command | ||
| + | after_script: | ||
| + | - !reference [.teardown, after_script] | ||
| + | |||
| + | </ | ||
gitlabci.1663862394.txt.gz · Last modified: by skipidar
