According to GitLab's CI documentation about !reference tag, it says:
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.
Can we use the !reference tag to reuse rules or any other allowed keyword?
See GitLab 14.3 (September 2021):
Support merging CI/CD rules arrays with !reference
The YAML
!referencetag introduced earlier this year helps you reuse and combine configuration.
This is a very flexible way to combine frequently reused configuration with job-specific configuration in one or more jobs.However, using it with the
ruleskeyword was not supported yet.In 14.3, we’ve added
!referencesupport to theruleskeyword, so you can now mix and matchrulesmore easily, including with configuration from different files.
You can use the CI/CD pipeline editor to view the merged configuration.
See Documentation and Issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With