Backend: Create a SSOT for CI config loading
Problem
Right now we load CI config in several locations in the codebase, but by default the Gitlab::Ci::Config::Yaml does not interpolate input parameters. This means we need to do interpolation everywhere.
Proposal
Create a SSoT class Gitlab::Ci::Config::Yaml::Loader that takes care of the interpolation and represents a safe abstraction to be used to load any CI configurations.
- We move
Config::External::InterpolatortoConfig::Yaml::Interpolator - We stop using module methods in
Gitlab::Ci::Config::Yaml - We move
Gitlab::Ci::Config::Yaml::Loaderinto its own filelib/gitlab/ci/config/yaml/loader.rband use it as the SSOT for GitLab CI configuration loading - We give
Gitlab::Ci::Config::Yaml::Loaderaload!method that returns the interpolated content of the configuration - We allow
Gitlab::Ci::Config::Yaml::Loaderto take an optional logger that can be used to track uses of interpolation
Details
We plan to support spec:inputs in .gitlab-ci.yml to enable pipeline inputs and replace prefilled variables for Run Pipeline form. We also want to support Compliance features built on top of templates and if a template defines spec:inputs we must load it and interpolate correctly.
Note: the presence of spec:inputs doesn't necessarily means that include:inputs must be used. The template could specify spec:inputs having all default values so passing include:inputs is not mandatory.
Implementation Plan
| Step | MR |
|---|---|
1. Move all CI config loading classes under Ci::Config::Yaml module |
!121409 (merged) |
2. Only call Interpolator from Loader
|
!122092 (merged) |
| 3. Update YAML loading in groupdynamic analysis classes | !129387 (merged) |
| 4. Update YAML loading in groupenvironments classes | !129377 (merged) |
| 5. Update YAML loading for simple cases in Verify classes | !129720 (merged) |
6. Spike: Update YAML loading for Ci::Config
|
!129739 (closed) |