Pipeline runs twice for one merge request #10

Open
opened 2026-03-20 16:09:20 +01:00 by lars.winzer · 1 comment
lars.winzer commented 2026-03-20 16:09:20 +01:00 (Migrated from git.scicore.unibas.ch)

Bug Report

Summary

After a merge request has been created, confirmed, and successfully merged, another pipeline run is dispatched, providing no real use besides hogging resources.

Steps to Reproduce

  1. Create a merge request
  2. Let the pipeline finish
  3. Confirm the merge
  4. Observe that the pipeline runs again (now for a push instead or a merge)

Expected Behavior

The pipeline should only run once for merge request related changes.

Actual Behavior

After the merge has been confirmed another pipeline run is dispatched.

Stack Trace / Error Message

Not relevant

Possible Cause

The start conditions for the on-commit run case are defined as follows:

.on-commit: &on-commit
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: never
    - if: '$CI_COMMIT_BRANCH'
      allow_failure: true

The second pipeline run is started, because CI_COMMIT_BRANCH matches for main and the merge commit that has been made after the merge request is merged.

Additionall information can be found in the official GitLab documentation

## Bug Report ### Summary After a merge request has been created, confirmed, and successfully merged, another pipeline run is dispatched, providing no real use besides hogging resources. ### Steps to Reproduce 1. Create a merge request 2. Let the pipeline finish 3. Confirm the merge 4. Observe that the pipeline runs again (now for a push instead or a merge) ### Expected Behavior The pipeline should only run once for merge request related changes. ### Actual Behavior After the merge has been confirmed another pipeline run is dispatched. ### Stack Trace / Error Message ``` Not relevant ``` ### Possible Cause The start conditions for the on-commit run case are defined as follows: ```yaml .on-commit: &on-commit rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' when: never - if: '$CI_COMMIT_BRANCH' allow_failure: true ``` The second pipeline run is started, because `CI_COMMIT_BRANCH` matches for `main` and the merge commit that has been made after the merge request is merged. Additionall information can be found in the [official GitLab documentation](https://docs.gitlab.com/ci/yaml/#rules)
lars.winzer commented 2026-03-31 12:13:53 +02:00 (Migrated from git.scicore.unibas.ch)

marked this issue as related to #24

marked this issue as related to #24
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: University-of-Basel-Studentprojects/Programmierprojekt#10