[polari] ci: Replace only/except with rules



commit 77d70f1dbce75074003b6f286a44615213db4356
Author: Jordan Petridis <jpetridis gnome org>
Date:   Fri Nov 20 14:54:13 2020 +0100

    ci: Replace only/except with rules
    
    only/except keywords where deperecated in favor of rules.
    
    Since we started using GNOME/gnome-shell!1492 it introduced
    a second pipeline being run for each commit.
    
    Detached pipelines are the only way to access CI_MERGE_REQUEST_*
    variables, and if we disable normal pipelines you will need to
    create wip/spam MRs in order to run the tests.
    
    This reworked rules makes it so, the normal pipeline needs manual
    interaction to be started, and the detached/MR pipleines is always
    run.
    
    https://gitlab.gnome.org/GNOME/polari/-/merge_requests/170

 .gitlab-ci.yml | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d21797b5..e202d593 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -25,11 +25,19 @@ variables:
     BUNDLE: "polari-git.flatpak"
     LINT_LOG: "eslint-report.xml"
 
-.only_default: &only_default
-    only:
-        - branches
-        - tags
-        - merge_requests
+workflow:
+    rules:
+        - if: '$CI_MERGE_REQUEST_IID'
+        - if: '$CI_COMMIT_TAG'
+        - if: '$CI_COMMIT_BRANCH'
+
+.pipeline_guard: &pipeline_guard
+    rules:
+        - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+        - if: '$CI_COMMIT_TAG'
+        - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+        - if: '$CI_COMMIT_BRANCH =~ /^gnome-[0-9-]+$/'
+        - when: 'manual'
 
 check_commit_log:
     extends:
@@ -37,7 +45,7 @@ check_commit_log:
     stage: pre_review
     script:
         - ./.gitlab-ci/check-commit-log.sh
-    <<: *only_default
+    <<: *pipeline_guard
     artifacts:
         expire_in: 1 week
         paths:
@@ -56,7 +64,7 @@ check-merge-request:
           else
             echo "Not a merge request" ;
           fi
-    <<: *only_default
+    <<: *pipeline_guard
     artifacts:
         expire_in: 1 week
         paths:
@@ -69,7 +77,6 @@ eslint:
     stage: review
     script:
         - eslint -o $LINT_LOG -f junit src
-    <<: *only_default
     artifacts:
         paths:
             - ${LINT_LOG}
@@ -85,7 +92,6 @@ eslint:
         FLATPAK_MODULE: "polari"
         APP_ID: "org.gnome.Polari"
     extends: .flatpak
-    <<: *only_default
 
 flatpak:
     variables:


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