I’m trying to DRY up several pipelines, and running into problems. Take this simple example:
bb_image: &image busybox
env: &env
environment:
- FOO=bar
- BAR=QUIX
common: &common
image: *image
environment:
- FOO=bar
- BAR=QUIX
pipeline:
one:
image: *image
<<: *env
commands:
- echo $FOO $BAR # these variables are empty
two:
<<: *common # error says "invalid or missing image"
commands:
- echo hello
This is valid YAML as far as I can tell (validated with http://yaml-online-parser.appspot.com/).
Why am I unable to merge in the map of environment variables in the first example?
Why does the second example return an error of invalid or missing image?
Are there other methods of reducing the amount of duplication in these configuration files, such that we don’t have to update all occurrences of image names and environment variables?
Thanks much!