Files
my-rook-config/tests/scripts/helm.sh
T

57 lines
1.3 KiB
Bash
Raw Normal View History

2017-08-24 14:55:01 -07:00
#!/bin/bash +e
2017-08-24 14:55:01 -07:00
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
temp="/tmp/rook-tests-scripts-helm"
2020-08-06 05:03:06 +00:00
HELM="${temp}/helm"
2020-05-28 22:06:48 +00:00
helm_version="${HELM_VERSION:-"v3.4.0"}"
arch="${ARCH:-}"
detectArch() {
case "$(uname -m)" in
"x86_64" | "amd64")
arch="amd64"
;;
"aarch64")
arch="arm64"
;;
"i386")
arch="i386"
;;
*)
echo "Couldn't translate 'uname -m' output to an available arch."
echo "Try setting ARCH environment variable to your system arch:"
echo "amd64, x86_64. aarch64, i386"
exit 1
;;
esac
}
2017-08-24 14:55:01 -07:00
install() {
2020-08-06 05:03:06 +00:00
# Download and unpack helm
if [ -x "${TEST_HELM_PATH}" ]; then
HELM="${TEST_HELM_PATH}"
else
local dist
dist="$(uname -s)"
2020-04-07 16:49:58 +00:00
dist=$(echo "${dist}" | tr "[:upper:]" "[:lower:]")
mkdir -p "${temp}"
2020-05-28 22:06:48 +00:00
wget "https://get.helm.sh/helm-${helm_version}-${dist}-${arch}.tar.gz" -O "${temp}/helm.tar.gz"
tar -C "${temp}" -xvf "${temp}/helm.tar.gz" --strip-components 1
fi
2017-08-24 14:55:01 -07:00
}
if [ -z "${arch}" ]; then
detectArch
fi
2017-08-24 14:55:01 -07:00
case "${1:-}" in
up)
install
;;
*)
echo "usage:" >&2
echo " $0 up" >&2
echo " $0 clean" >&2
2017-08-24 14:55:01 -07:00
esac