From e0437a4237c99a16955d5ec56ff5fe9996c76b57 Mon Sep 17 00:00:00 2001 From: Remigiusz Janeczek Date: Tue, 16 Mar 2021 16:00:26 +0100 Subject: Add helm validator sources Issue-ID: SDC-3185 Signed-off-by: Remigiusz Janeczek Change-Id: I32dea3b4294a90c4dfc75864fb4200f044e7a0b6 --- scripts/collect_helm_versions_from_web.sh | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 scripts/collect_helm_versions_from_web.sh (limited to 'scripts') 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 -- cgit 1.2.3-korg