blob: ad678e9843472a797b089da0cfe52ae57ae7e235 [file] [log] [blame]
Pawel Wieczorekf1176da2019-12-05 13:45:45 +01001#!/usr/bin/env bash
2
3#
4# @file test/security/k8s/tools/dublin/get_helm.sh
5# @author Pawel Wieczorek <p.wieczorek2@samsung.com>
6# @brief Utility for obtaining helm tool
7#
8
9# Dependencies:
10# wget
11# tar
12# coreutils
13#
14# Privileges:
15# Script expects to be run with administrative privileges for accessing /usr/local/bin
16#
17# Usage:
18# # ./get_helm.sh [VERSION [ARCH [SYSTEM]]]
19#
20
21# Constants
22BINARY='helm'
23INSTALL_DIR='/usr/local/bin/'
24
25DEFAULT_VERSION='v2.14.2'
26DEFAULT_ARCH='amd64'
27DEFAULT_SYSTEM='linux'
28
29# Variables
30VERSION="${1:-$DEFAULT_VERSION}"
31ARCH="${2:-$DEFAULT_ARCH}"
32SYSTEM="${3:-$DEFAULT_SYSTEM}"
33
34URL="https://storage.googleapis.com/kubernetes-helm/${BINARY}-${VERSION}-${SYSTEM}-${ARCH}.tar.gz"
35ARCHIVE="${URL##*/}"
36DIR="${SYSTEM}-${ARCH}"
37
38
39# Prerequistes
40wget "$URL"
41tar xf "$ARCHIVE"
42
43# Installation
44mv "${DIR}/${BINARY}" "$INSTALL_DIR"
45
46# Cleanup
47rm "$ARCHIVE"
48rm -r "$DIR"