Moritz
Moritz

Reputation: 426

run GitLab pipeline: check if merge breaks the project

I have a GitLab CI/CD configuration, which runs a pipeline at a commit-push in a Merge Request. In combination with "Merge checks"->"Pipelines must succeed", we can only merge, when a Pipeline is successful, which is what I want.

variables:
  GIT_SUBMODULE_STRATEGY: recursive

stages:
  - build

# build program and examples
build:
  stage: build
  script:
    - cmake -B build
    - cmake --build build
  rules: # run only on main and in MR
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"'

But I just noticed a problem. It is possible, that the MR pipeline succeeds (the state of the branch compiles), but the project does not compile after/with the merge (the main branch and the branch with the successful pipeline).
Is there a configuration, which checks if the merged branch also builds/tests successful, without actually merging it into main/master?

Upvotes: 0

Views: 389

Answers (1)

Egor
Egor

Reputation: 1090

It is possible to use merged results pipelines to run target branch pipeline with changes from current merge request before merging.

Upvotes: 0

Related Questions