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 14:01] – skipidar | gitlabci [2022/09/22 16:35] (current) – skipidar | ||
---|---|---|---|
Line 171: | Line 171: | ||
- | === disable | + | === hide a job (.job) |
Start the job name with a dot (.) and it is not processed by GitLab CI/CD | Start the job name with a dot (.) and it is not processed by GitLab CI/CD | ||
+ | https:// | ||
<sxh yaml> | <sxh yaml> | ||
Line 183: | Line 184: | ||
+ | === includes of another files === | ||
+ | You can include | ||
+ | - from a subfolder | ||
+ | - from another gitlab-repository using " | ||
+ | <sxh yaml> | ||
+ | include: | ||
+ | - gitlab_pipeline_jobs/ | ||
+ | - gitlab_pipeline_jobs/ | ||
+ | - project: " | ||
+ | ref: master | ||
+ | file: " | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | === extends: syntax === | ||
+ | You can use the " | ||
+ | when the included modules shouldnt be activated automatically. | ||
+ | |||
+ | Instead you should include those with customized variables. | ||
+ | |||
+ | https:// | ||
+ | |||
+ | <sxh yaml> | ||
+ | .tests: | ||
+ | script: rake test | ||
+ | stage: test | ||
+ | only: | ||
+ | refs: | ||
+ | - branches | ||
+ | |||
+ | rspec: | ||
+ | extends: .tests | ||
+ | script: rake rspec | ||
+ | only: | ||
+ | variables: | ||
+ | - $RSPEC | ||
+ | </ | ||
+ | |||
+ | |||
+ | === extends: syntax === | ||
+ | |||
+ | |||
+ | |||
+ | === <<: *my_anchor reuse properties with anchors === | ||
+ | Using anchors you can reuse attriburtes across jobs, | ||
+ | especially from a disabled job: | ||
+ | |||
+ | <sxh yaml> | ||
+ | |||
+ | .deployment: | ||
+ | image: path/ | ||
+ | tags: | ||
+ | - LAUNCHTAG | ||
+ | |||
+ | |||
+ | .deploy_to_prod: | ||
+ | <<: *deployment | ||
+ | variables: !reference [.env_variables, | ||
+ | |||
+ | .deploy_to_prodint: | ||
+ | <<: *deployment | ||
+ | variables: !reference [.env_variables, | ||
+ | | ||
+ | </ | ||
+ | |||
+ | |||
+ | === !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.1663855272.txt.gz · Last modified: by skipidar