Currently gitlab runs a pipeline when creating a merge request + branch with the GUI.
Is it possible to skip this pipeline, since it's only repeats the last pipeline from the default branch?
We tried with:
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
This works to skip new branch pipelines, but it doesn't run a pipeline for new commits on branches which have no merge request.
In order to stop pipeline execution when a new branch is created and in the same time run when a new commit happens on a branch
Try change from:
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
To
workflow:
rules:
- if: $CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000"
when: never
- if: $CI_MERGE_REQUEST_IID
- if: $CI_PIPELINE_SOURCE == "push"
The rule
- if: $CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000"
when: never
Will stop the execution of a new pipeline when a new branch is created
The rule
- if: $CI_PIPELINE_SOURCE == "push"
This is added to allow a new pipeline trigger when a commit happens on branch, because if the event is not a merge request the pipeline won't execute.