Add !reference to the CI syntax to merge YAML arrays [RUN ALL RSPEC] [RUN AS-IF-FOSS]
What does this MR do?
Related to #266173 (closed)
Makes it possible to reference blocks of the CI definition across files:
# Content of setup.yml
.setup:
script:
- echo creating environment1
- echo creating environment2
# Content of teardown.yml
.teardown:
script:
- echo deleting environment1
- echo deleting environment2
# .gitlab-ci.yml
include:
- local: setup.yml
- local: teardown.yml
test:
script:
- !reference [.setup, script]
- echo running my own command
- !reference [.teardown, script]
Variables example:
.vars:
variables:
URL: "http://my-url.internal"
IMPORTANT_VAR: "the details"
# brings all variables from .vars
test vars 1:
variables: !reference [.vars, variables]
script:
- printenv
# brings only IMPORTANT_VAR from .vars and exposes it as MY_VAR
test vars 2:
variables:
MY_VAR: !reference [.vars, variables, IMPORTANT_VAR]
script:
- printenv
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Marius Bobin