aboutsummaryrefslogtreecommitdiffstats
path: root/test/security/k8s/tools
diff options
context:
space:
mode:
authorPawel Wieczorek <p.wieczorek2@samsung.com>2019-06-27 18:11:16 +0200
committerPawel Wieczorek <p.wieczorek2@samsung.com>2019-07-08 12:29:52 +0200
commit60fef55b8719c0fcb07c81da7e75f818f32bbfb5 (patch)
treeb5e79fa6a6e78470afe1e10baf29ff9a04d9bdff /test/security/k8s/tools
parenta65cd1ca58eae2348ff50487cc1b5c6d05531fc3 (diff)
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 <p.wieczorek2@samsung.com>
Diffstat (limited to 'test/security/k8s/tools')
-rwxr-xr-xtest/security/k8s/tools/get_ranchercli.sh25
1 files changed, 20 insertions, 5 deletions
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"