i use lot of anchors for split big yml script and for by this way réuse the code in several job script, but seem not possible to save anchors into separate file include and to load them in yml main scripts, main script must contain also the anchors, i saw lot of request on it.
My question when gitlab will implement the feature include yml with anchors only. I read same issue with extends. but i my case i need anchors. An idea on which version that will be implemented ?
i use actually 12.6.6
I have a similar problem. I have a list of script segments accessible via yaml anchors.
As this list of script segments are the same for all projects but which segments are used
in the projects I would like to externalize the segments into an own yaml file and include it.
E.g. I looks like this:
// .gitlab-aspects.yaml
# Do some commands specific to aspectA
.aspectA: &aspectA
- ‘install stuff’
- ‘export SOME_ENV=specific_to aspectA’
# Do some commands specific to aspectB
.aspectB: &aspectB
- 'install other stuff'
- 'export SOME_OTHER_ENV=specific_to aspectB'
# and the list go one
The template is then used in the real .gitlab-ci.yaml file:
So the trick with extends job does not work, as the script arrays are not merged.
Is there a fundamental reason which yaml anchors won’t work? It would help immensely
if yaml anchors combined with include would work.