Quality: Explicitly map pipeline sources to be used for `only/except:`
Problem statement
!20930 (merged) introduced a bug on production because we renamed one of the sources value (from pipeline
to cross_project_pipeline
). This invalidated the YAML policy only/except: pipeline
and wasn't either reflected in the documentation. Also, no specs failed.
With the current design, by adding or changing values in Ci::PipelineEnums.sources
we directly impact the use of only/except:
policy and likely rules:
too (when sources will be supported).
Gitlab::Ci::Build::Policy::Refs
doesn't have good coverage especially around the use of pipeline.source
. This is why specs didn't fail in !20930 (merged)
Solution
- We should add an abstraction layer between the
Ci::PipelineEnums.sources
and what is allowed to be used inonly/except:
policy. This layer could simply mapCi::PipelineEnums.sources
with the values used byGitlab::Ci::Build::Policy::Refs
. - Add a comment in the new mapping layer to remember to modify the documentation for any changes
- We need to have specs in place for
Gitlab::Ci::Build::Policy::Refs
that can prevent against unexpected side effects, e.g. by changingCi:PipelineEnums.source
. E.g. iterate through the mapped sources and ensure they all work.
This would help separating backstage changes from user-facing ones as well as have separate specs.
All above for only/except:
would eventually be applied to rules:
(when it supports pipeline sources).