I would like to merge arrays in YAML, and load them via ruby –
some_stuff: &some_stuff
- a
- b
- c
combined_stuff:
<<: *some_stuff
- d
- e
- f
I'd like to have the combined array as [a,b,c,d,e,f]
I receive the error: did not find expected key while parsing a block mapping
How do I merge arrays in YAML?
Best Answer
If the aim is to run a sequence of shell commands, you may be able to achieve this as follows:
This is equivalent to:
I have been using this on my
gitlab-ci.yml
(to answer @rink.attendant.6 comment on the question).Working example that we use to support
requirements.txt
having private repos from gitlab:where
requirements_test.txt
contains e.g.-e git+ssh://git@gitlab.com/example/example.git@v0.2.2#egg=example