[damned-lies/develop] feat: exclude jobs from scheduled pipelines




commit 93b2daef15886a51ad2310ef1c54212b7bd54550
Author: Guillaume Bernard <associations guillaume-bernard fr>
Date:   Mon Sep 5 12:09:48 2022 +0200

    feat: exclude jobs from scheduled pipelines

 .gitlab-ci.yml | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7652419c..172aed44 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -70,6 +70,11 @@ variables:
     expire_in: 3 hours
     when: on_success
 
+.exclude_job_from_scheduled_pipeline:
+  rules:
+    - &rule_exclude_job_from_scheduled_pipeline
+      if: $CI_PIPELINE_SOURCE == "schedule"
+      when: manual
 
 ##############################################################################
 ###################             Pre Build                  ###################
@@ -120,6 +125,7 @@ pages:
     # Run the job on the default branch only.
     - if: $CI_COMMIT_BRANCH == "$CI_DEFAULT_BRANCH"
       when: always
+    - *rule_exclude_job_from_scheduled_pipeline
     - when: never
       allow_failure: true
 
@@ -135,6 +141,8 @@ package:
     paths:
       - dist/
     expire_in: 1 week
+  rules:
+    - *rule_exclude_job_from_scheduled_pipeline
 
 
 build_container:production:
@@ -143,6 +151,7 @@ build_container:production:
   rules:
     - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
       when: always
+    - *rule_exclude_job_from_scheduled_pipeline
     - when: never
 
 
@@ -154,6 +163,7 @@ build_container:test:
   rules:
     - if: $CI_COMMIT_BRANCH == "develop"
       when: always
+    - *rule_exclude_job_from_scheduled_pipeline
     - when: never
 
 
@@ -186,12 +196,16 @@ test:
         coverage_format: cobertura
         path: coverage.xml
       junit: tests-report.xml
+  rules:
+    - *rule_exclude_job_from_scheduled_pipeline
 
 
 .static-analysis:
   stage: test
   dependencies: []
   allow_failure: true
+  rules:
+    - *rule_exclude_job_from_scheduled_pipeline
 
 
 static-analysis:prospector:
@@ -256,6 +270,7 @@ deploy:staging:
   rules:
     - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
       when: on_success
+    - *rule_exclude_job_from_scheduled_pipeline
 
 
 deploy:production:
@@ -273,6 +288,7 @@ deploy:production:
   rules:
     - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
       when: manual
+    - *rule_exclude_job_from_scheduled_pipeline
     - when: never
 
 
@@ -291,4 +307,5 @@ deploy:test:
   rules:
     - if: $CI_COMMIT_BRANCH == "develop"
       when: on_success
+    - *rule_exclude_job_from_scheduled_pipeline
     - when: never


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