CI YAML: Allow extends to merge values if they're arrays
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem to solve
We want to have an easy way to merge arrays when using extends
.
As per https://docs.gitlab.com/ee/ci/yaml/#extends, "GitLab will Not merge the values of the keys".
Intended users
- Sasha (Software Developer)
- Devon (DevOps Engineer)
- Simone (Software Engineer in Test)
- Allison (Application Ops)
Further details
Proposal
Input:
.tests:
script: rake test
stage: test
only:
refs:
- /^staging/
rspec:
extends:
- section: .tests
strategy: merge # default: overwrite
script: rake rspec
only:
refs:
- /^preprod/
Actual output, assuming extends: .tests
:
rspec:
script: rake rspec
stage: test
only:
refs:
- /^preprod/ # It overwrote /^staging/
Expected output with introduction of extends:strategy: merge
:
rspec:
script: rake rspec
stage: test
only:
refs:
- /^staging/
- /^preprod/ # Merged instead of overwritten
Links / references
Labels: ci-build devopsverify devopsconfigure ~"devops::release" (not sure exactly which one, things were simpler when CI/CD label exited
CC @markglenfletcher @ayufan @grzesiek @jyavorska
Edited by 🤖 GitLab Bot 🤖