From 60fef55b8719c0fcb07c81da7e75f818f32bbfb5 Mon Sep 17 00:00:00 2001
From: Pawel Wieczorek
Date: Thu, 27 Jun 2019 18:11:16 +0200
Subject: k8s: Make Rancher CLI provisioner configurable
Apparently Linux AMD64 machines are not the only ones used for ONAP
development (author meant no harm).
Issue-ID: SECCOM-235
Change-Id: Ia78a02fb82dc5752d6b8fd2cef8e6ef583fd3ca6
Signed-off-by: Pawel Wieczorek
---
test/security/k8s/tools/get_ranchercli.sh | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
(limited to 'test/security')
diff --git a/test/security/k8s/tools/get_ranchercli.sh b/test/security/k8s/tools/get_ranchercli.sh
index d36a94edb..a5295fb17 100755
--- a/test/security/k8s/tools/get_ranchercli.sh
+++ b/test/security/k8s/tools/get_ranchercli.sh
@@ -1,13 +1,28 @@
#!/usr/bin/env bash
+# Constants
+DEFAULT_VERSION='v0.6.12'
+DEFAULT_ARCH='amd64'
+DEFAULT_SYSTEM='linux'
+
+# Variables
+VERSION="${1:-$DEFAULT_VERSION}"
+ARCH="${2:-$DEFAULT_ARCH}"
+SYSTEM="${3:-$DEFAULT_SYSTEM}"
+
+ARCHIVE="rancher-${SYSTEM}-${ARCHITECTURE}-${VERSION}.tar.gz"
+DIRECTORY="rancher-${VERSION}"
+URL="https://releases.rancher.com/cli/${VERSION}/${ARCHIVE}"
+
+
# Prerequistes
-wget https://releases.rancher.com/cli/v0.6.12/rancher-linux-amd64-v0.6.12.tar.gz
-tar xf rancher-linux-amd64-v0.6.12.tar.gz
+wget "$URL"
+tar xf "$ARCHIVE"
# Installation
echo '# Privilege elevation needed to move Rancher CLI binary to /usr/local/bin'
-sudo mv rancher-v0.6.12/rancher /usr/local/bin/
+sudo mv "${DIRECTORY}/rancher" /usr/local/bin/
# Cleanup
-rmdir rancher-v0.6.12/
-rm rancher-linux-amd64-v0.6.12.tar.gz
+rmdir "$DIRECTORY"
+rm "$ARCHIVE"
--
cgit 1.2.3-korg