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




commit 36beb4c39dae2f6b9a424704dd78713bc18282d0
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 | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 06fcb3d4a..86cf9af25 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:
@@ -139,7 +149,7 @@ track:
   retry: 2
   # only run on branches targeting master
   rules:
-  - if: $FLATPAK_BRANCH == 'master' && $CI_MERGE_REQUEST_ID == null
+  - if: $FLATPAK_BRANCH == 'master'
   artifacts:
     paths:
     - project.refs


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