Skip to content

Avoid unnecessary ci pipeline jobs during branching

Ritesh Raj Sarraf requested to merge wip/ritesh/unset-set-ci-pipeline into master

At the moment, when we do our release branching, our Gitlab instance is flooded with a pipeline job for every new branch created. This is a waste of compute resources as the new branch is a replicate of the current branch and should just be skipped.

For details, on the upstream issue, see: https://gitlab.com/gitlab-org/gitlab/-/issues/15170

With this change, the interim fix is to:

  1. Set ci_config_path to null
  2. Create a new branch
  3. Set ci_config_path to a valid path

These steps run in unison, avoid the creation of the ci pipeline job

Example:
$ ./gitlab-rulez diff ./branch.yaml --filter pkg/bash
3308 pkg/bash
project pkg/bash: settings: set ci_config_path to None
project pkg/bash: settings: save changes
project pkg/bash: ensure_branch: branch apertis/delete-me from apertis/v2022dev0
project pkg/bash: settings: set default_branch to apertis/delete-me
project pkg/bash: settings: save changes
project pkg/bash: settings: set ci_config_path to ci-package-builder.yml@infrastructure/ci-package-builder
project pkg/bash: settings: save changes
computed 7 actions

A special handling is required in gitlab_rulez script to exempt the attribute 'ci_config_path' because we are flipping the value twice in the same run, without which otherwise, it'd skip the second request of the 'ci_config_path' change.

Example:
$ ./gitlab-rulez diff ./branch.yaml --filter pkg/bash
3308 pkg/bash
project pkg/bash: settings: set ci_config_path to None
project pkg/bash: settings: save changes
project pkg/bash: ensure_branch: branch apertis/delete-me from apertis/v2022dev0
project pkg/bash: settings: set default_branch to apertis/delete-me
project pkg/bash: settings: save changes
computed 5 actions

Signed-off-by: Ritesh Raj Sarraf ritesh.sarraf@collabora.com

Edited by Ritesh Raj Sarraf

Merge request reports