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




commit 693456f719b0949af50fd4a429c9c99c1ffa3bfa
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 bakc on creating a regular "branch"
    pipeline.
    
    https://docs.gitlab.com/ee/ci/yaml/index.html#workflowrules

 .gitlab-ci.yml | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 06fcb3d4a..71552a3cd 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_TAG'
+    - if: '$CI_COMMIT_BRANCH'
+
 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]