Job config: add an element to an existing list of files

196 Views Asked by At

I'm trying to work with list variables in ZUUL jobs to avoid duplicating definitions of file exclusion patterns. Now I have a job definition that looks like this:

- job:
name: base-job
vars:
  my_set_of_files: &myFileSet
    - ^.README.*
    - ^.*.md

- job:
    name: foo
    parent: base-job
    irrelevant_files: *myFileSet

- job:
    name: bar
    parent: base-job
    irrelevant_files: *myFileSet
      - *.xml

But while 'foo' works nicely, I don't seem to be able to add another element for my 'bar' job.

How can I reuse, but slightly modify the list 'myFileSet' in another job config?

1

There are 1 best solutions below

0
On

After some more investigation I discovered that referencing a list is a yaml feature, not a ZUUL feature.

The same problem has already been discussed e.g. here: Is there YAML syntax for sharing part of a list or map? and here: How to merge YAML arrays?

Unfortunately, there is no native solution. The links above are also discussing notation solutions that are based on using a custom parser, which is not an option within ZUUL. So it does not seem to be possible as such.

Instead, I will either defien multiple variants of this list, or define the irrelevant files explicitly.