[gnome-build-meta/alatiera/mr-pipelines: 4/4] ci: Switch to merge request pipelines when possible




commit 73c9ba6228c7e7832e36788b4e087377df9122af
Author: Jordan Petridis <jordan centricular com>
Date:   Tue Oct 4 13:46:57 2022 +0200

    ci: Switch to merge request pipelines when possible
    
    This would create a merge request pipeline if there's an MR
    open, else it will fall back on creating a regular "branch"
    pipeline.
    
    https://docs.gitlab.com/ee/ci/yaml/index.html#workflowrules
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-build-meta/-/merge_requests/1794>

 .gitlab-ci.yml | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 70415a420..a990202c4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -23,6 +23,16 @@ stages:
 - test
 - reports
 
+workflow:
+  # https://docs.gitlab.com/ee/ci/yaml/index.html#switch-between-branch-pipelines-and-merge-request-pipelines
+  rules:
+    - if: '$CI_PIPELINE_SOURCE == "schedules" || $CI_PIPELINE_SOURCE == "web"'
+    - 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 && $CI_COMMIT_REF_PROTECTED == "true"'
+    - if: '$CI_COMMIT_TAG'
+
 default:
   image: "${DOCKER_REGISTRY}/bst16:${DOCKER_IMAGE_ID}"
   before_script:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]