Skip to content

CI: run push pipelines only when there is no open merge request

Detailed Description

LALSuite has 2 basic CI pipelines:

  • on branch pushes, the CI runs a limited set of jobs to test for basic compilation and code quality errors
  • on opening a merge request, the CI runs the full suite of jobs testing packaging, platforms, compilers, etc.

Currently, if one opens a merge request, but then pushes updated commits, a new branch push pipeline is triggered as well as a new merge request pipeline. This is unnecessary as the branch pipeline is a limited subset of the checks the full merge request pipeline covers.

This MR modified the CI workflow directive to prevent a new branch push pipeline from being triggered when there is already an associated merge request. This is done by testing the $CI_OPEN_MERGE_REQUESTS CI/CD variable; if null, then no merge requests are associated with the branch, and the branch push pipeline runs. Otherwise, the workflow falls through to the final when: never directive.

No running the redundant branch push pipeline will save some compute cycles, and lessen the load on the GitLab runners.

Testing

When this MR was created, it listed 2 pipelines: the branch pipeline from the initial push (named LALSuite CI/CD), and the merge request pipeline (named MR pipeline):

img1

When I then pushed an update to the merge request branch, this triggered a new merge request pipeline (also named MR pipeline), but no new branch pipeline, as required:

img2

(The old merge request pipeline is also cancelled, which was already in the CI set up.)

API Changes

Please tick one of the following options:

  • These changes do not modify the API.
  • These changes do modify the API, and are backwards compatible.
  • These changes do modify the API, and are backwards incompatible.

For examples of changes that do not modify the API and/or are considered backwards (in)compatible, please see the contributing guide.

Justification for Backwards Incompatible Changes

n/a

Review Status

n/a

Edited by Karl Wette

Merge request reports

Loading