Grouping CI jobs by name: YAML syntax proposal

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

This issue is a YAML syntax proposal for GitLab CI. This was spawned by this earlier issue.

Problem to solve

CI pipelines with many jobs can be difficult to navigate. It would be useful to be able to group jobs together in a flexible, simple way.

Currently, CI jobs can be grouped within a pipeline by giving the CI jobs names that mutually match a regular expression. To quote from the documentation:

This regular expression evaluates the job names: ([\b\s:]+((\[.*\])|(\d+[\s:\/\\]+\d+)))+\s*\z. One or more : [...], X Y, X/Y, or X\Y sequences are removed from the end of job names only. Matching substrings found at the beginning or in the middle of job names are not removed.

This feature requires that the job names be appended with numbers. In many cases, this cannot be done in a natural way. For example, if a pipeline had several CI jobs for deploying code to specific target servers, e.g.

  • deploy foo
  • deploy bar
  • deploy baz

then this feature cannot (realistically) be used.

CI stages are also not a perfect fit to the problem, as one could imagine wanting to group these servers by their region; having a separate CI stage for each region would both be misleading and not solve the problem of navigation.

Proposal

The YAML syntax for GitLab CI could add an optional group_name key for jobs as follows:

deploy foo:
  needs:
    - job: assets
      artifacts: true
  group_name: deploy

deploy bar:
  needs:
    - job: assets
      artifacts: true
  group_name: deploy

deploy baz:
  needs:
    - job: assets
      artifacts: true
  group_name: deploy

This would both select the jobs that are to be grouped and set the label to be used.

Edited by 🤖 GitLab Bot 🤖