summaryrefslogtreecommitdiffstats
path: root/scripts/collect_helm_versions_from_web.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/collect_helm_versions_from_web.sh')
-rwxr-xr-xscripts/collect_helm_versions_from_web.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/scripts/collect_helm_versions_from_web.sh b/scripts/collect_helm_versions_from_web.sh
new file mode 100755
index 0000000..6155149
--- /dev/null
+++ b/scripts/collect_helm_versions_from_web.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+set -e
+
+HELM_TMP_DIR=helm_tmp
+HELM_VERSIONS_DIR=helm_versions
+IS_LOCAL=false
+if [ "$1" == "local" ]; then
+ IS_LOCAL=true
+fi
+
+readarray -d , -t SUPPORTED_VERSION_ARRAY <<<"$HELM_SUPPORTED_VERSIONS"
+
+mkdir -p $HELM_VERSIONS_DIR
+mkdir -p $HELM_TMP_DIR
+
+getHelm() {
+ VERSION=$1
+ echo "Attempt to collect HELM ${VERSION}"
+
+ if [ -a "$HELM_VERSIONS_DIR/helm-v${VERSION}" ]; then
+ echo "HELM ${VERSION} already exists"
+ else
+ mkdir -p $HELM_TMP_DIR/v${VERSION}
+ echo "Downloading..."
+ wget -q https://get.helm.sh/helm-v${VERSION}-linux-amd64.tar.gz -O $HELM_TMP_DIR/helm-v${VERSION}.tar.gz
+ echo "Archive Extracting..."
+ tar -zxvf $HELM_TMP_DIR/helm-v${VERSION}.tar.gz -C $HELM_TMP_DIR/v${VERSION} linux-amd64/helm
+ mv $HELM_TMP_DIR/v${VERSION}/linux-amd64/helm $HELM_VERSIONS_DIR/helm-v${VERSION}
+ fi
+
+ echo "DONE"
+}
+
+for i in "${SUPPORTED_VERSION_ARRAY[@]}"; do
+ getHelm $i
+done
+
+if [ $IS_LOCAL == false ]; then
+ mv $HELM_VERSIONS_DIR/* /usr/local/bin/
+ rm -r $HELM_VERSIONS_DIR
+ rm -r $HELM_TMP_DIR
+fi