From 1c801b1637b2364f9aa5dc233fdf07b73d0f05ec Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Mon, 4 Jan 2021 21:08:15 +0200
Subject: [PATCH] Select host in deploy script.

Select the host in the deploy script, default to all hosts.
---
 deploy | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/deploy b/deploy
index 80dc37c..79e4be3 100755
--- a/deploy
+++ b/deploy
@@ -1,7 +1,7 @@
 #!/bin/sh
 set -eu
 
-deploy() {
+_deploy() {
     echo "Deploying to $1" >&2
     export DOCKER_HOST="ssh://$1"
     export RUNNER_NAME="$1"
@@ -25,10 +25,19 @@ then
     exit 1
 fi
 
-export REGISTER_RUN_UNTAGGED="true"
-export BUILDS='/builds'
-deploy "ns4.shore.co.il"
-export REGISTER_RUN_UNTAGGED="false"
-unset BUILDS
-deploy "host01.shore.co.il"
-deploy "kodi.shore.co.il"
+case "${1:-all}" in
+    ns4) export REGISTER_RUN_UNTAGGED="true"
+        export BUILDS='/builds'
+        _deploy ns4
+        ;;
+    kodi) export REGISTER_RUN_UNTAGGED="false"
+        unset BUILDS
+        _deploy kodi
+        ;;
+    host01) export REGISTER_RUN_UNTAGGED="false"
+        unset BUILDS
+        _deploy host01
+        ;;
+    all) deploy ns4; deploy host01; deploy kodi ;;
+    *) echo 'Unknown host.' >&2; exit 1;;
+esac
-- 
GitLab