From 49a82ef32500852b73c97f4bc51eac8ffbc4f85f Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Wed, 10 Nov 2021 14:38:51 +0200
Subject: [PATCH] Use the new dynamic variables in tags.

---
 .gitlab-ci.yml | 65 +++++++++++---------------------------------------
 1 file changed, 14 insertions(+), 51 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cae7508..1d72c48 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,59 +10,22 @@ stages:
   - build
   - deploy
 
-# FIXME: Remove duplicate jobs once
-# https://gitlab.com/gitlab-org/gitlab/-/issues/35742 is resolved.
-
-build-ns4:
-  extends: .compose-build
-  tags: [ns4.shore.co.il]
-  only:
-    - ns4
-
-pull-ns4:
-  extends: .compose-pull
-  tags: [ns4.shore.co.il]
-  only:
-    - ns4
-
-run-ns4:
-  extends: .compose-run
-  tags: [ns4.shore.co.il]
-  only:
-    - ns4
-
-build-host01:
-  extends: .compose-build
-  tags: [host01.shore.co.il]
-  only:
-    - host01
-
-pull-host01:
-  extends: .compose-pull
-  tags: [host01.shore.co.il]
-  only:
-    - host01
-
-run-host01:
-  extends: .compose-run
-  tags: [host01.shore.co.il]
-  only:
-    - host01
-
-build-kodi:
+build:
   extends: .compose-build
-  tags: [kodi.shore.co.il]
-  only:
-    - kodi
+  tags: ["$CI_COMMIT_BRANCH.shore.co.il"]
+  rules:
+    # yamllint disable-line rule:line-length
+    - if: &if $CI_COMMIT_BRANCH == "host01" || $CI_COMMIT_BRANCH == "ns4" || $CI_COMMIT_BRANCH == "kodi"
 
-pull-kodi:
+pull:
   extends: .compose-pull
-  tags: [kodi.shore.co.il]
-  only:
-    - kodi
+  tags: ["$CI_COMMIT_BRANCH.shore.co.il"]
+  rules:
+    - if: *if
 
-run-kodi:
+run:
   extends: .compose-run
-  tags: [kodi.shore.co.il]
-  only:
-    - kodi
+  tags: ["$CI_COMMIT_BRANCH.shore.co.il"]
+  rules:
+    - if: *if
+      when: manual
-- 
GitLab