From 0f77939714655a4993ece227daf7e8c89e6aee69 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Wed, 29 Sep 2021 15:15:03 +0300 Subject: [PATCH] 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: --- .gitlab-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 69ab3e9bf7..8e7a44dd68 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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