Skip to content

Use Gitlab::Ci::Config::Yaml.load! in ci_template_unique_counter.rb

What does this MR do and why?

As explained at #368951 (comment 1065719944):

This is caused by the use of !reference custom YAML tag that YAML.safe_load doesn't support.

The correct way of loading a GitLab CI YAML file is Gitlab::Ci::Config::Yaml.load!(content).

This isn't perfect as ideally:

At least we should use Gitlab::Ci::YamlProcessor as the lowest level of abstraction. Anything lower than that makes the code very fragile (especially for security features) because it's built under some private assumptions.

But here I'm focusing on solving the transient error we sometimes get when running the tests, see #386191 (closed).

How to set up and validate locally

The class is already well-tested and the behavior shouldn't change.

MR acceptance checklist

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

Related to #386191 (closed).

Edited by Rémy Coutable

Merge request reports