gitlab-ci.yaml anchor concatenation in script or after_script
Description
It is not possible to use multiple anchors to construct scripts or after_scripts. This would come in very handy in constructing more complex scripts without code duplication.
My Idea is to use a .gitlab.yaml like this:
.echo_foo_after-script: &foo
- echo foo
.echo_bar_after-script: &bar
- echo bar
test1:
script:
- do_some_thing
after_script:
<<: *foo
test2:
script:
- do_some_thing_else
after_script:
<<: [*foo, *bar]
For test2 echo_foo_after-script and echo_bar_after-script schould be executed in the order they are called. And for test1 it is just echo_foo_after-script.
At the moment you will end up in a Syntax error like this: Error: jobs:unidirectional_communication:after_script config should be an array of strings
Or is there already a way to do this ?