ci: Rework workflow rules to prevent duplicate pipelines

Currently gitlab spawns 2 pipelines, one for the branch and
another for the merge request.

Update our rules so that only one of them is spawned depending
on the situation.

https://docs.gitlab.com/ee/ci/yaml/index.html#switch-between-branch-pipelines-and-merge-request-pipelines

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/958>
This commit is contained in:
Jordan Petridis 2021-09-29 15:15:03 +03:00 committed by GStreamer Marge Bot
parent 62077b9d05
commit 0f77939714

View file

@ -81,10 +81,12 @@ variables:
-Dgstreamer-sharp:werror=true
workflow:
# https://docs.gitlab.com/ee/ci/yaml/index.html#switch-between-branch-pipelines-and-merge-request-pipelines
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- if: '$CI_COMMIT_BRANCH'
#
# Global CI policy