Skip to content

Fix invalid YAML merges in ci config

Arran Walker requested to merge ajwalker/fix-invalid/yaml into master

What does this MR do and why?

This fixes several cases where invalid YAML merges are used in our pipeline config.

These are valid for the Ruby YAML library, but invalid according to the YAML specification.

In the YAML Spec, mapping keys should be unique (https://yaml.org/spec/1.2.2/#mapping).

The content of a mapping node is an unordered set of key/value node pairs, with the restriction that each of the keys is unique.

Merges (https://yaml.org/type/merge.html) are a "Language-Independent Type", so shouldn't require a modification of the underlying language to be supported.

The fix:

something:
  <<: *something_else
  <<: *another_thing

should be:

something:
  <<: [ *something_else, *another_thing ]

There's an example of a multi merge in the spec: https://yaml.org/type/merge.html

This allows stricter parsers and IDE linters to correctly validate the YAML.

There should be no difference to the pipeline generated.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Arran Walker

Merge request reports