From 88035d965016946ee8b68ad69df11ee83b5cff78 Mon Sep 17 00:00:00 2001
From: Tunde Oladipupo <toladipupo@oteemo.com>
Date: Tue, 23 Mar 2021 21:48:47 +0000
Subject: [PATCH] Override ci conditionals to run all infrastructure tests when
 MR contains "test-ci::infra" label

---
 .gitlab-ci.yml | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e8fc2bc88e..2956a16cfd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -157,24 +157,24 @@ upgrade:
 .infra fork:
   stage: network up
   rules:
-    # Run on scheduled jobs
-    - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == "master"'
+    # Run on scheduled jobs OR when `test-ci` label is assigned
+    - if: '($CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == "master") || $CI_MERGE_REQUEST_LABELS =~ "test-ci::infra"'
       allow_failure: false
 
 # Abstract for jobs responsible for creating infrastructure
 .infra create:
   rules:
-    # Run on scheduled jobs
-    - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == "master"'
+    # Run on scheduled jobs OR when `test-ci` label is assigned
+    - if: '($CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == "master") || $CI_MERGE_REQUEST_LABELS =~ "test-ci::infra"'
     # skip job when branch name starts with "hotfix" or "patch"
     - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^(hotfix|patch)/'
       when: never
 
-# Abstract for jobs responsible for cleaning up infrastructure
+# Abstract for jobs responsible for cleaning up infrastructure OR when `test-ci` label is assigned
 .infra cleanup:
   rules:
     # Run on scheduled jobs
-    - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == "master"'
+    - if: '($CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == "master") || $CI_MERGE_REQUEST_LABELS =~ "test-ci::infra"'
       allow_failure: true
       when: always
 
-- 
GitLab