summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2024-04-30 08:43:55 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2024-04-30 08:46:00 +1000
commit414757317d6d1b370fbd38d87ce4bf2802e40809 (patch)
treeb7157c6b424f05fac21c8dd2ba9a678c0ce26214
parentfb5402020ff77f455f777477e1638b8fe7b0bd19 (diff)
gitlab CI: don't run MR pipelines in forksHEADmaster
Commit originally by Simon Ser in wayland/wayland-protocols!305. Currently our CI setup has a downside: for each push on a merge request, two pipelines are triggered. The first is triggered in the context of the forked repository, and the second is triggered in the context of the MR in the parent repository. Replace the workflow rules with the ones in the official docs [1], so that a branch pipeline isn't triggered when a MR exists for that branch. [1]: https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--.gitlab-ci.yml6
-rw-r--r--.gitlab-ci/ci.template6
2 files changed, 8 insertions, 4 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d524c64..e4b739a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -29,8 +29,10 @@ stages:
workflow:
rules:
- - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- - if: $CI_PIPELINE_SOURCE == 'push'
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+ - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
+ when: never
+ - if: $CI_COMMIT_BRANCH
variables:
# The upstrem repository we will check for images
diff --git a/.gitlab-ci/ci.template b/.gitlab-ci/ci.template
index 520144b..799e06d 100644
--- a/.gitlab-ci/ci.template
+++ b/.gitlab-ci/ci.template
@@ -29,8 +29,10 @@ stages:
workflow:
rules:
- - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- - if: $CI_PIPELINE_SOURCE == 'push'
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+ - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
+ when: never
+ - if: $CI_COMMIT_BRANCH
variables:
# The upstrem repository we will check for images