Add value aliases to parallel:matrix job names

What does this MR do and why?

Adds an optional { value:, alias: } form for parallel:matrix values. The alias is used in the generated job name, while the CI/CD variable keeps the full value. This keeps job names readable and under the 255-character limit when matrix values are long, such as image references, URLs, or paths.

build:
  parallel:
    matrix:
      - OS: [ubuntu, alpine]
        IMAGE:
          - value: registry.example.com/builder-u20:0.0.3
            alias: u20
          - registry.example.com/builder-u22:0.0.1

This generates build: [ubuntu, u20], build: [ubuntu, registry.example.com/builder-u22:0.0.1], and so on. $IMAGE always contains the full value.

  • needs:parallel:matrix finds the needed job by its full value or its alias. The value/alias hash form is rejected in needs.
  • When aliases are used, matrices that generate duplicate job names are rejected. Matrices without aliases keep the current behavior.
  • The CI JSON schema is not changed yet: the pipeline rejects the new form while the flag is disabled, so the editor should too. The schema update will follow with the rollout in #634481.
  • The change is behind the ci_parallel_matrix_value_alias feature flag (beta, disabled by default). With the flag disabled, the hash form fails validation.

This builds on the patch that @nikhil_raman shared in the issue.

References

Screenshots or screen recordings

Not applicable: no UI changes. Job names keep the existing job: [a, b] format.

How to set up and validate locally

  1. In the Rails console, enable the feature flag:
    Feature.enable(:ci_parallel_matrix_value_alias)
  2. Run a pipeline with the example from doc/ci/yaml/_index.md#parallelmatrix.
  3. Check the job names, and check that $IMAGE contains the full value in each job.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Ugo Mignon

Merge request reports

Loading
Loading