From 58865739e203ab5f592d111e0cfba9243c67db81 Mon Sep 17 00:00:00 2001 From: gauravsaini04 <147703805+gauravsaini04@users.noreply.github.com> Date: Fri, 23 Feb 2024 08:21:09 +0000 Subject: [PATCH 1/6] [kubectl-helm-minikube]: Handle failing build with fallback to prev. version --- src/kubectl-helm-minikube/install.sh | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/kubectl-helm-minikube/install.sh b/src/kubectl-helm-minikube/install.sh index 5deb377c3..7a3527d79 100755 --- a/src/kubectl-helm-minikube/install.sh +++ b/src/kubectl-helm-minikube/install.sh @@ -122,6 +122,12 @@ case $architecture in *) echo "(!) Architecture $architecture unsupported"; exit 1 ;; esac +# Function to fetch the version released prior to the latest version +get_previous_version() { + repo_url=$1 + curl -s "$repo_url" | jq -r 'del(.[].assets) | .[1].tag_name' # this would del the assets key and then get the second encountered tag_name's value from the filtered array of objects +} + if [ ${KUBECTL_VERSION} != "none" ]; then # Install the kubectl, verify checksum echo "Downloading kubectl..." @@ -135,6 +141,16 @@ if [ ${KUBECTL_VERSION} != "none" ]; then fi curl -sSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl" chmod 0755 /usr/local/bin/kubectl + if [ -e "/usr/local/bin/kubectl" ]; then + if grep -q "The specified key does not exist." "/usr/local/bin/kubectl"; then + echo -e "\n(!) Failed to fetch the latest artifacts for docker buildx ${KUBECTL_VERSION}..." + repo_url=https://api.github.com/repos/kubernetes/kubernetes/releases + requested_version=$(get_previous_version "${repo_url}") + echo -e "\nAttempting to install ${requested_version}" + curl -sSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${requested_version}/bin/linux/${architecture}/kubectl" + KUBECTL_VERSION="${requested_version}" + fi + fi if [ "$KUBECTL_SHA256" = "automatic" ]; then KUBECTL_SHA256="$(curl -sSL "https://dl.k8s.io/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl.sha256")" fi @@ -167,6 +183,18 @@ if [ ${HELM_VERSION} != "none" ]; then tmp_helm_filename="/tmp/helm/${helm_filename}" curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}" curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" + output=$(cat /tmp/helm/"${helm_filename}.asc") + if [[ "${output}" == *"Not Found"* ]]; then + echo -e "\n(!) Failed to fetch the latest artifacts for docker buildx ${HELM_VERSION}..." + repo_url=https://api.github.com/repos/helm/helm/releases + requested_version=$(get_previous_version "${repo_url}") + echo -e "\nAttempting to install ${requested_version}" + helm_filename="helm-${requested_version}-linux-${architecture}.tar.gz" + tmp_helm_filename="/tmp/helm/${helm_filename}" + curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}" + curl -sSL "https://github.com/helm/helm/releases/download/${requested_version}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" + HELM_VERSION=${requested_version} + fi export GNUPGHOME="/tmp/helm/gnupg" mkdir -p "${GNUPGHOME}" chmod 700 ${GNUPGHOME} @@ -215,6 +243,16 @@ if [ "${MINIKUBE_VERSION}" != "none" ]; then # latest is also valid in the download URLs curl -sSL -o /usr/local/bin/minikube "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-${architecture}" chmod 0755 /usr/local/bin/minikube + if [ -e "/usr/local/bin/minikube" ]; then + if grep -q "The specified key does not exist." "/usr/local/bin/minikube"; then + echo -e "\n(!) Failed to fetch the latest artifacts for docker buildx ${MINIKUBE_VERSION}..." + repo_url=https://api.github.com/repos/kubernetes/minikube/releases + requested_version=$(get_previous_version "${repo_url}") + echo -e "\nAttempting to install ${requested_version}" + curl -sSL -o /usr/local/bin/minikube "https://storage.googleapis.com/minikube/releases/${requested_version}/minikube-linux-${architecture}" + MINIKUBE_VERSION="${requested_version}" + fi + fi if [ "$MINIKUBE_SHA256" = "automatic" ]; then MINIKUBE_SHA256="$(curl -sSL "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-${architecture}.sha256")" fi From 0f5716c8efdfb491b4747e20f1a1aa72df39ff32 Mon Sep 17 00:00:00 2001 From: gauravsaini04 <147703805+gauravsaini04@users.noreply.github.com> Date: Fri, 23 Feb 2024 22:25:30 +0000 Subject: [PATCH 2/6] changes acc. to comments and added tests --- src/kubectl-helm-minikube/install.sh | 12 +- .../install_only_helm_fallback.sh | 122 ++++++++++++++++++ .../install_only_kubectl_fallback.sh | 95 ++++++++++++++ .../install_only_minikube_fallback.sh | 95 ++++++++++++++ test/kubectl-helm-minikube/scenarios.json | 30 +++++ 5 files changed, 348 insertions(+), 6 deletions(-) create mode 100644 test/kubectl-helm-minikube/install_only_helm_fallback.sh create mode 100644 test/kubectl-helm-minikube/install_only_kubectl_fallback.sh create mode 100644 test/kubectl-helm-minikube/install_only_minikube_fallback.sh diff --git a/src/kubectl-helm-minikube/install.sh b/src/kubectl-helm-minikube/install.sh index 7a3527d79..15c4cf057 100755 --- a/src/kubectl-helm-minikube/install.sh +++ b/src/kubectl-helm-minikube/install.sh @@ -125,7 +125,8 @@ esac # Function to fetch the version released prior to the latest version get_previous_version() { repo_url=$1 - curl -s "$repo_url" | jq -r 'del(.[].assets) | .[1].tag_name' # this would del the assets key and then get the second encountered tag_name's value from the filtered array of objects + # this would del the assets key and then get the second encountered tag_name's value from the filtered array of objects + curl -s "$repo_url" | jq -r 'del(.[].assets) | .[1].tag_name' } if [ ${KUBECTL_VERSION} != "none" ]; then @@ -140,10 +141,8 @@ if [ ${KUBECTL_VERSION} != "none" ]; then KUBECTL_VERSION="v${KUBECTL_VERSION}" fi curl -sSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl" - chmod 0755 /usr/local/bin/kubectl if [ -e "/usr/local/bin/kubectl" ]; then if grep -q "The specified key does not exist." "/usr/local/bin/kubectl"; then - echo -e "\n(!) Failed to fetch the latest artifacts for docker buildx ${KUBECTL_VERSION}..." repo_url=https://api.github.com/repos/kubernetes/kubernetes/releases requested_version=$(get_previous_version "${repo_url}") echo -e "\nAttempting to install ${requested_version}" @@ -151,6 +150,7 @@ if [ ${KUBECTL_VERSION} != "none" ]; then KUBECTL_VERSION="${requested_version}" fi fi + chmod 0755 /usr/local/bin/kubectl if [ "$KUBECTL_SHA256" = "automatic" ]; then KUBECTL_SHA256="$(curl -sSL "https://dl.k8s.io/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl.sha256")" fi @@ -185,7 +185,7 @@ if [ ${HELM_VERSION} != "none" ]; then curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" output=$(cat /tmp/helm/"${helm_filename}.asc") if [[ "${output}" == *"Not Found"* ]]; then - echo -e "\n(!) Failed to fetch the latest artifacts for docker buildx ${HELM_VERSION}..." + echo -e "\n(!) Failed to fetch the latest artifacts for helm ${HELM_VERSION}..." repo_url=https://api.github.com/repos/helm/helm/releases requested_version=$(get_previous_version "${repo_url}") echo -e "\nAttempting to install ${requested_version}" @@ -242,10 +242,9 @@ if [ "${MINIKUBE_VERSION}" != "none" ]; then fi # latest is also valid in the download URLs curl -sSL -o /usr/local/bin/minikube "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-${architecture}" - chmod 0755 /usr/local/bin/minikube if [ -e "/usr/local/bin/minikube" ]; then if grep -q "The specified key does not exist." "/usr/local/bin/minikube"; then - echo -e "\n(!) Failed to fetch the latest artifacts for docker buildx ${MINIKUBE_VERSION}..." + echo -e "\n(!) Failed to fetch the latest artifacts for minikube ${MINIKUBE_VERSION}..." repo_url=https://api.github.com/repos/kubernetes/minikube/releases requested_version=$(get_previous_version "${repo_url}") echo -e "\nAttempting to install ${requested_version}" @@ -253,6 +252,7 @@ if [ "${MINIKUBE_VERSION}" != "none" ]; then MINIKUBE_VERSION="${requested_version}" fi fi + chmod 0755 /usr/local/bin/minikube if [ "$MINIKUBE_SHA256" = "automatic" ]; then MINIKUBE_SHA256="$(curl -sSL "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-${architecture}.sha256")" fi diff --git a/test/kubectl-helm-minikube/install_only_helm_fallback.sh b/test/kubectl-helm-minikube/install_only_helm_fallback.sh new file mode 100644 index 000000000..56be9dcea --- /dev/null +++ b/test/kubectl-helm-minikube/install_only_helm_fallback.sh @@ -0,0 +1,122 @@ +#!/bin/bash +set -e + +# Optional: Import test library +source dev-container-features-test-lib +HL="\033[1;33m" +N="\033[0;37m" +echo -e "\nšŸ‘‰${HL} helm version as installed by kubectl-helm-minikube feature${N}:" + +set +e + check "helm version" helm version +set -e + +# Function to handle errors +handle_error() { + local exit_code=$? + local line_number=$1 + local command=$2 + echo "Error occurred at line $line_number with exit code $exit_code in command $command" + exit $exit_code +} +trap 'handle_error $LINENO ${BASH_COMMAND%% *}' ERR +echo "This is line $LINENO" + +## Check for fallback version installation instead of latest ( when artifact not found ) +architecture="$(uname -m)" +case $architecture in + x86_64) architecture="amd64";; + aarch64 | armv8*) architecture="arm64";; + aarch32 | armv7* | armvhf*) architecture="arm";; + i?86) architecture="386";; + *) echo "(!) Architecture $architecture unsupported"; exit 1 ;; +esac +HELM_SHA256="${HELM_SHA256:-"automatic"}" +HELM_GPG_KEYS_URI="https://raw.githubusercontent.com/helm/helm/main/KEYS" + +repo_url=https://api.github.com/repos/helm/helm/releases + +# Function to fetch the latest version of the plugin +get_latest_version() { + curl -s "$repo_url/latest" | jq -r '.tag_name' +} + +# Function to change the patch number in a semver version +change_patch_number() { + local version="$1" # Input version + local new_patch="$2" # New patch number + # Extract major, minor, and current patch numbers + local major=$(echo "$version" | cut -d. -f1) + local minor=$(echo "$version" | cut -d. -f2) + local current_patch=$(echo "$version" | cut -d. -f3) + # Construct the new version with the updated patch number + local new_version="$major.$minor.$new_patch" + echo "$new_version" +} + +# Function to fetch the previous version of the plugin +get_previous_version() { + # this would del the assets key and then get the second encountered tag_name's value from the filtered array of objects + curl -s "$repo_url" | jq -r 'del(.[].assets) | .[1].tag_name' +} + +latest_version=$(get_latest_version) +HELM_VERSION="$(change_patch_number ${latest_version} xyz)" +echo -e "\nšŸ‘‰${HL} Trying to install HELM_VERSION = ${HELM_VERSION}${N}"; +sudo mkdir -p /tmp/helm +helm_filename="helm-${HELM_VERSION}-linux-${architecture}.tar.gz" +tmp_helm_filename="/tmp/helm/${helm_filename}" +sudo curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}" +sudo curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" +output=$(sudo cat /tmp/helm/"${helm_filename}.asc") +if [[ "${output}" == *"Not Found"* ]]; then + echo -e "\n(!) Failed to fetch the latest artifacts for helm ${HELM_VERSION}..." + requested_version=$(get_previous_version) + echo -e "\nAttempting to install ${requested_version}" + helm_filename="helm-${requested_version}-linux-${architecture}.tar.gz" + tmp_helm_filename="/tmp/helm/${helm_filename}" + sudo curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}" + sudo curl -sSL "https://github.com/helm/helm/releases/download/${requested_version}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" + HELM_VERSION=${requested_version} +fi +export GNUPGHOME="/tmp/helm/gnupg" +sudo mkdir -p "${GNUPGHOME}" +sudo chmod 700 ${GNUPGHOME} +sudo curl -sSL "${HELM_GPG_KEYS_URI}" -o /tmp/helm/KEYS +sudo echo -e "disable-ipv6\n${GPG_KEY_SERVERS}" | sudo tee ${GNUPGHOME}/dirmngr.conf >/dev/null +sudo gpg -q --import "/tmp/helm/KEYS" +if ! sudo gpg --verify "${tmp_helm_filename}.asc" | sudo tee ${GNUPGHOME}/verify.log 2>&1; then + echo "Verification failed!" + sudo cat /tmp/helm/gnupg/verify.log + exit 1 +fi + +if [ "${HELM_SHA256}" = "automatic" ]; then + sudo curl -sSL "https://get.helm.sh/${helm_filename}.sha256" -o "${tmp_helm_filename}.sha256" + sudo curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.sha256.asc" -o "${tmp_helm_filename}.sha256.asc" + if ! sudo gpg --verify "${tmp_helm_filename}.sha256.asc" | sudo tee /tmp/helm/gnupg/verify.log 2>&1; then + echo "Verification failed!" + sudo cat /tmp/helm/gnupg/verify.log + exit 1 + fi + HELM_SHA256="$(sudo cat "${tmp_helm_filename}.sha256")" +fi + +([ "${HELM_SHA256}" = "dev-mode" ] || (sudo echo "${HELM_SHA256} *${tmp_helm_filename}" | sha256sum -c -)) +sudo tar xf "${tmp_helm_filename}" -C /tmp/helm +sudo mv -f "/tmp/helm/linux-${architecture}/helm" /usr/local/bin/ +sudo chmod 0755 /usr/local/bin/helm +sudo rm -rf /tmp/helm +if ! type helm > /dev/null 2>&1; then + echo '(!) Helm installation failed!' + exit 1 +fi + +echo -e "\nšŸ‘‰${HL} helm version as installed by test for fallback${N}:" + +set +e + check "helm version" helm version +set -e + +# Report result +reportResults diff --git a/test/kubectl-helm-minikube/install_only_kubectl_fallback.sh b/test/kubectl-helm-minikube/install_only_kubectl_fallback.sh new file mode 100644 index 000000000..04b05f6aa --- /dev/null +++ b/test/kubectl-helm-minikube/install_only_kubectl_fallback.sh @@ -0,0 +1,95 @@ +#!/bin/bash +set -e + +# Function to handle errors +handle_error() { + local exit_code=$? + local line_number=$1 + local command=$2 + echo "Error occurred at line $line_number with exit code $exit_code in command $command" + exit $exit_code +} +trap 'handle_error $LINENO ${BASH_COMMAND%% *}' ERR +echo "This is line $LINENO" + +# Optional: Import test library +source dev-container-features-test-lib + +HL="\033[1;33m" +N="\033[0;37m" + +echo -e "\nšŸ‘‰${HL} kubectl version as installed by kubectl-helm-minikube feature${N}:" +set +e + check "kubectl version" kubectl version --client +set -e + +## Check for fallback version installation instead of latest ( when artifact not found ) + +architecture="$(uname -m)" +case $architecture in + x86_64) architecture="amd64";; + aarch64 | armv8*) architecture="arm64";; + aarch32 | armv7* | armvhf*) architecture="arm";; + i?86) architecture="386";; + *) echo "(!) Architecture $architecture unsupported"; exit 1 ;; +esac + +KUBECTL_SHA256="${KUBECTL_SHA256:-"automatic"}" + +repo_url=https://api.github.com/repos/kubernetes/kubernetes/releases + +# Function to fetch the latest version of the plugin +get_latest_version() { + curl -s "$repo_url/latest" | jq -r '.tag_name' +} + +# Function to change the patch number in a semver version +change_patch_number() { + local version="$1" # Input version + local new_patch="$2" # New patch number + # Extract major, minor, and current patch numbers + local major=$(echo "$version" | cut -d. -f1) + local minor=$(echo "$version" | cut -d. -f2) + local current_patch=$(echo "$version" | cut -d. -f3) + # Construct the new version with the updated patch number + local new_version="$major.$minor.$new_patch" + echo "$new_version" +} + +# Function to fetch the previous version of the plugin +get_previous_version() { + # this would del the assets key and then get the second encountered tag_name's value from the filtered array of objects + curl -s "$repo_url" | jq -r 'del(.[].assets) | .[1].tag_name' +} + + +latest_version=$(get_latest_version) +KUBECTL_VERSION="$(change_patch_number ${latest_version} xyz)" +echo -e "\nšŸ‘‰${HL} Trying to install KUBECTL_VERSION = ${KUBECTL_VERSION}${N}"; +sudo curl -sSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl" +if [ -e "/usr/local/bin/kubectl" ]; then + if grep -q "The specified key does not exist." "/usr/local/bin/kubectl"; then + echo -e "\n(!) Failed to fetch the latest artifacts for kubectl ${KUBECTL_VERSION}..." + requested_version=$(get_previous_version) + echo -e "\nAttempting to install ${requested_version}" + sudo curl -sSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${requested_version}/bin/linux/${architecture}/kubectl" + KUBECTL_VERSION="${requested_version}" + fi +fi +sudo chmod 0755 /usr/local/bin/kubectl +if [ "$KUBECTL_SHA256" = "automatic" ]; then + KUBECTL_SHA256="$(sudo curl -sSL "https://dl.k8s.io/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl.sha256")" +fi +([ "${KUBECTL_SHA256}" = "dev-mode" ] || (sudo echo "${KUBECTL_SHA256} */usr/local/bin/kubectl" | sha256sum -c -)) +if ! type kubectl > /dev/null 2>&1; then + echo '(!) kubectl installation failed!' + exit 1 +fi + +echo -e "\nšŸ‘‰${HL} kubectl version as installed by this test for fallback installation${N}:" +set +e + check "kubectl version" kubectl version --client +set -e + +# Report result +reportResults diff --git a/test/kubectl-helm-minikube/install_only_minikube_fallback.sh b/test/kubectl-helm-minikube/install_only_minikube_fallback.sh new file mode 100644 index 000000000..747c946ff --- /dev/null +++ b/test/kubectl-helm-minikube/install_only_minikube_fallback.sh @@ -0,0 +1,95 @@ +#!/bin/bash +set -e + +# Function to handle errors +handle_error() { + local exit_code=$? + local line_number=$1 + local command=$2 + echo "Error occurred at line $line_number with exit code $exit_code in command $command" + exit $exit_code +} +trap 'handle_error $LINENO ${BASH_COMMAND%% *}' ERR +echo "This is line $LINENO" + +# Optional: Import test library +source dev-container-features-test-lib + +HL="\033[1;33m" +N="\033[0;37m" + +echo -e "\nšŸ‘‰${HL} minikube version as installed by kubectl-helm-minikube feature${N}:" +set +e + check "minikube version" minikube version +set -e + +## Check for fallback version installation instead of latest ( when artifact not found ) + +architecture="$(uname -m)" +case $architecture in + x86_64) architecture="amd64";; + aarch64 | armv8*) architecture="arm64";; + aarch32 | armv7* | armvhf*) architecture="arm";; + i?86) architecture="386";; + *) echo "(!) Architecture $architecture unsupported"; exit 1 ;; +esac + +MINIKUBE_SHA256="${MINIKUBE_SHA256:-"automatic"}" + +repo_url=https://api.github.com/repos/kubernetes/minikube/releases + +# Function to fetch the latest version of the plugin +get_latest_version() { + curl -s "$repo_url/latest" | jq -r '.tag_name' +} + +# Function to change the patch number in a semver version +change_patch_number() { + local version="$1" # Input version + local new_patch="$2" # New patch number + # Extract major, minor, and current patch numbers + local major=$(echo "$version" | cut -d. -f1) + local minor=$(echo "$version" | cut -d. -f2) + local current_patch=$(echo "$version" | cut -d. -f3) + # Construct the new version with the updated patch number + local new_version="$major.$minor.$new_patch" + echo "$new_version" +} + +# Function to fetch the previous version of the plugin +get_previous_version() { + # this would del the assets key and then get the second encountered tag_name's value from the filtered array of objects + curl -s "$repo_url" | jq -r 'del(.[].assets) | .[1].tag_name' +} + + +latest_version=$(get_latest_version) +MINIKUBE_VERSION="$(change_patch_number ${latest_version} xyz)" +echo -e "\nšŸ‘‰${HL} Trying to install MINIKUBE_VERSION = ${MINIKUBE_VERSION}${N}"; +sudo curl -sSL -o /usr/local/bin/minikube "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-${architecture}" +if [ -e "/usr/local/bin/minikube" ]; then + if grep -q "The specified key does not exist." "/usr/local/bin/minikube"; then + echo -e "\n(!) Failed to fetch the latest artifacts for minikube ${MINIKUBE_VERSION}..." + requested_version=$(get_previous_version "${repo_url}") + echo -e "\nAttempting to install ${requested_version}" + sudo curl -sSL -o /usr/local/bin/minikube "https://storage.googleapis.com/minikube/releases/${requested_version}/minikube-linux-${architecture}" + MINIKUBE_VERSION="${requested_version}" + fi +fi +sudo chmod 0755 /usr/local/bin/minikube +if [ "$MINIKUBE_SHA256" = "automatic" ]; then + MINIKUBE_SHA256="$(sudo curl -sSL "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-${architecture}.sha256")" +fi + ([ "${MINIKUBE_SHA256}" = "dev-mode" ] || (sudo echo "${MINIKUBE_SHA256} */usr/local/bin/minikube" | sha256sum -c -)) + if ! type minikube > /dev/null 2>&1; then + echo '(!) minikube installation failed!' + exit 1 + fi + +echo -e "\nšŸ‘‰${HL} minikube version as installed by this test for fallback installation${N}:" +set +e + check "minikube version" minikube version +set -e + +# Report result +reportResults diff --git a/test/kubectl-helm-minikube/scenarios.json b/test/kubectl-helm-minikube/scenarios.json index 08ff8cc79..6b3988f60 100644 --- a/test/kubectl-helm-minikube/scenarios.json +++ b/test/kubectl-helm-minikube/scenarios.json @@ -8,5 +8,35 @@ "minikube": "none" } } + }, + "install_only_kubectl_fallback": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "features": { + "kubectl-helm-minikube": { + "version": "latest", + "helm": "none", + "minikube": "none" + } + } + }, + "install_only_helm_fallback": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "features": { + "kubectl-helm-minikube": { + "version": "none", + "helm": "latest", + "minikube": "none" + } + } + }, + "install_only_minikube_fallback": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "features": { + "kubectl-helm-minikube": { + "version": "none", + "helm": "none", + "minikube": "latest" + } + } } } From 538af69345357aeeab377bef65f0af0cea666e63 Mon Sep 17 00:00:00 2001 From: gauravsaini04 <147703805+gauravsaini04@users.noreply.github.com> Date: Sat, 24 Feb 2024 04:41:54 +0000 Subject: [PATCH 3/6] only to add fallback mechanism for helm and removed for kubectl & minikube --- src/kubectl-helm-minikube/install.sh | 35 ++----- .../install_only_kubectl_fallback.sh | 95 ------------------- .../install_only_minikube_fallback.sh | 95 ------------------- test/kubectl-helm-minikube/scenarios.json | 20 ---- 4 files changed, 8 insertions(+), 237 deletions(-) delete mode 100644 test/kubectl-helm-minikube/install_only_kubectl_fallback.sh delete mode 100644 test/kubectl-helm-minikube/install_only_minikube_fallback.sh diff --git a/src/kubectl-helm-minikube/install.sh b/src/kubectl-helm-minikube/install.sh index 15c4cf057..d88362fd8 100755 --- a/src/kubectl-helm-minikube/install.sh +++ b/src/kubectl-helm-minikube/install.sh @@ -122,13 +122,6 @@ case $architecture in *) echo "(!) Architecture $architecture unsupported"; exit 1 ;; esac -# Function to fetch the version released prior to the latest version -get_previous_version() { - repo_url=$1 - # this would del the assets key and then get the second encountered tag_name's value from the filtered array of objects - curl -s "$repo_url" | jq -r 'del(.[].assets) | .[1].tag_name' -} - if [ ${KUBECTL_VERSION} != "none" ]; then # Install the kubectl, verify checksum echo "Downloading kubectl..." @@ -141,15 +134,6 @@ if [ ${KUBECTL_VERSION} != "none" ]; then KUBECTL_VERSION="v${KUBECTL_VERSION}" fi curl -sSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl" - if [ -e "/usr/local/bin/kubectl" ]; then - if grep -q "The specified key does not exist." "/usr/local/bin/kubectl"; then - repo_url=https://api.github.com/repos/kubernetes/kubernetes/releases - requested_version=$(get_previous_version "${repo_url}") - echo -e "\nAttempting to install ${requested_version}" - curl -sSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${requested_version}/bin/linux/${architecture}/kubectl" - KUBECTL_VERSION="${requested_version}" - fi - fi chmod 0755 /usr/local/bin/kubectl if [ "$KUBECTL_SHA256" = "automatic" ]; then KUBECTL_SHA256="$(curl -sSL "https://dl.k8s.io/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl.sha256")" @@ -171,6 +155,13 @@ if [ ${KUBECTL_VERSION} != "none" ]; then fi fi +# Function to fetch the version released prior to the latest version +get_previous_version() { + repo_url=$1 + # this would del the assets key and then get the second encountered tag_name's value from the filtered array of objects + curl -s "$repo_url" | jq -r 'del(.[].assets) | .[1].tag_name' +} + if [ ${HELM_VERSION} != "none" ]; then # Install Helm, verify signature and checksum echo "Downloading Helm..." @@ -183,7 +174,7 @@ if [ ${HELM_VERSION} != "none" ]; then tmp_helm_filename="/tmp/helm/${helm_filename}" curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}" curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" - output=$(cat /tmp/helm/"${helm_filename}.asc") + output=$(cat /tmp/helm/"${helm_filename}.asc") if [[ "${output}" == *"Not Found"* ]]; then echo -e "\n(!) Failed to fetch the latest artifacts for helm ${HELM_VERSION}..." repo_url=https://api.github.com/repos/helm/helm/releases @@ -242,16 +233,6 @@ if [ "${MINIKUBE_VERSION}" != "none" ]; then fi # latest is also valid in the download URLs curl -sSL -o /usr/local/bin/minikube "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-${architecture}" - if [ -e "/usr/local/bin/minikube" ]; then - if grep -q "The specified key does not exist." "/usr/local/bin/minikube"; then - echo -e "\n(!) Failed to fetch the latest artifacts for minikube ${MINIKUBE_VERSION}..." - repo_url=https://api.github.com/repos/kubernetes/minikube/releases - requested_version=$(get_previous_version "${repo_url}") - echo -e "\nAttempting to install ${requested_version}" - curl -sSL -o /usr/local/bin/minikube "https://storage.googleapis.com/minikube/releases/${requested_version}/minikube-linux-${architecture}" - MINIKUBE_VERSION="${requested_version}" - fi - fi chmod 0755 /usr/local/bin/minikube if [ "$MINIKUBE_SHA256" = "automatic" ]; then MINIKUBE_SHA256="$(curl -sSL "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-${architecture}.sha256")" diff --git a/test/kubectl-helm-minikube/install_only_kubectl_fallback.sh b/test/kubectl-helm-minikube/install_only_kubectl_fallback.sh deleted file mode 100644 index 04b05f6aa..000000000 --- a/test/kubectl-helm-minikube/install_only_kubectl_fallback.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -set -e - -# Function to handle errors -handle_error() { - local exit_code=$? - local line_number=$1 - local command=$2 - echo "Error occurred at line $line_number with exit code $exit_code in command $command" - exit $exit_code -} -trap 'handle_error $LINENO ${BASH_COMMAND%% *}' ERR -echo "This is line $LINENO" - -# Optional: Import test library -source dev-container-features-test-lib - -HL="\033[1;33m" -N="\033[0;37m" - -echo -e "\nšŸ‘‰${HL} kubectl version as installed by kubectl-helm-minikube feature${N}:" -set +e - check "kubectl version" kubectl version --client -set -e - -## Check for fallback version installation instead of latest ( when artifact not found ) - -architecture="$(uname -m)" -case $architecture in - x86_64) architecture="amd64";; - aarch64 | armv8*) architecture="arm64";; - aarch32 | armv7* | armvhf*) architecture="arm";; - i?86) architecture="386";; - *) echo "(!) Architecture $architecture unsupported"; exit 1 ;; -esac - -KUBECTL_SHA256="${KUBECTL_SHA256:-"automatic"}" - -repo_url=https://api.github.com/repos/kubernetes/kubernetes/releases - -# Function to fetch the latest version of the plugin -get_latest_version() { - curl -s "$repo_url/latest" | jq -r '.tag_name' -} - -# Function to change the patch number in a semver version -change_patch_number() { - local version="$1" # Input version - local new_patch="$2" # New patch number - # Extract major, minor, and current patch numbers - local major=$(echo "$version" | cut -d. -f1) - local minor=$(echo "$version" | cut -d. -f2) - local current_patch=$(echo "$version" | cut -d. -f3) - # Construct the new version with the updated patch number - local new_version="$major.$minor.$new_patch" - echo "$new_version" -} - -# Function to fetch the previous version of the plugin -get_previous_version() { - # this would del the assets key and then get the second encountered tag_name's value from the filtered array of objects - curl -s "$repo_url" | jq -r 'del(.[].assets) | .[1].tag_name' -} - - -latest_version=$(get_latest_version) -KUBECTL_VERSION="$(change_patch_number ${latest_version} xyz)" -echo -e "\nšŸ‘‰${HL} Trying to install KUBECTL_VERSION = ${KUBECTL_VERSION}${N}"; -sudo curl -sSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl" -if [ -e "/usr/local/bin/kubectl" ]; then - if grep -q "The specified key does not exist." "/usr/local/bin/kubectl"; then - echo -e "\n(!) Failed to fetch the latest artifacts for kubectl ${KUBECTL_VERSION}..." - requested_version=$(get_previous_version) - echo -e "\nAttempting to install ${requested_version}" - sudo curl -sSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${requested_version}/bin/linux/${architecture}/kubectl" - KUBECTL_VERSION="${requested_version}" - fi -fi -sudo chmod 0755 /usr/local/bin/kubectl -if [ "$KUBECTL_SHA256" = "automatic" ]; then - KUBECTL_SHA256="$(sudo curl -sSL "https://dl.k8s.io/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl.sha256")" -fi -([ "${KUBECTL_SHA256}" = "dev-mode" ] || (sudo echo "${KUBECTL_SHA256} */usr/local/bin/kubectl" | sha256sum -c -)) -if ! type kubectl > /dev/null 2>&1; then - echo '(!) kubectl installation failed!' - exit 1 -fi - -echo -e "\nšŸ‘‰${HL} kubectl version as installed by this test for fallback installation${N}:" -set +e - check "kubectl version" kubectl version --client -set -e - -# Report result -reportResults diff --git a/test/kubectl-helm-minikube/install_only_minikube_fallback.sh b/test/kubectl-helm-minikube/install_only_minikube_fallback.sh deleted file mode 100644 index 747c946ff..000000000 --- a/test/kubectl-helm-minikube/install_only_minikube_fallback.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -set -e - -# Function to handle errors -handle_error() { - local exit_code=$? - local line_number=$1 - local command=$2 - echo "Error occurred at line $line_number with exit code $exit_code in command $command" - exit $exit_code -} -trap 'handle_error $LINENO ${BASH_COMMAND%% *}' ERR -echo "This is line $LINENO" - -# Optional: Import test library -source dev-container-features-test-lib - -HL="\033[1;33m" -N="\033[0;37m" - -echo -e "\nšŸ‘‰${HL} minikube version as installed by kubectl-helm-minikube feature${N}:" -set +e - check "minikube version" minikube version -set -e - -## Check for fallback version installation instead of latest ( when artifact not found ) - -architecture="$(uname -m)" -case $architecture in - x86_64) architecture="amd64";; - aarch64 | armv8*) architecture="arm64";; - aarch32 | armv7* | armvhf*) architecture="arm";; - i?86) architecture="386";; - *) echo "(!) Architecture $architecture unsupported"; exit 1 ;; -esac - -MINIKUBE_SHA256="${MINIKUBE_SHA256:-"automatic"}" - -repo_url=https://api.github.com/repos/kubernetes/minikube/releases - -# Function to fetch the latest version of the plugin -get_latest_version() { - curl -s "$repo_url/latest" | jq -r '.tag_name' -} - -# Function to change the patch number in a semver version -change_patch_number() { - local version="$1" # Input version - local new_patch="$2" # New patch number - # Extract major, minor, and current patch numbers - local major=$(echo "$version" | cut -d. -f1) - local minor=$(echo "$version" | cut -d. -f2) - local current_patch=$(echo "$version" | cut -d. -f3) - # Construct the new version with the updated patch number - local new_version="$major.$minor.$new_patch" - echo "$new_version" -} - -# Function to fetch the previous version of the plugin -get_previous_version() { - # this would del the assets key and then get the second encountered tag_name's value from the filtered array of objects - curl -s "$repo_url" | jq -r 'del(.[].assets) | .[1].tag_name' -} - - -latest_version=$(get_latest_version) -MINIKUBE_VERSION="$(change_patch_number ${latest_version} xyz)" -echo -e "\nšŸ‘‰${HL} Trying to install MINIKUBE_VERSION = ${MINIKUBE_VERSION}${N}"; -sudo curl -sSL -o /usr/local/bin/minikube "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-${architecture}" -if [ -e "/usr/local/bin/minikube" ]; then - if grep -q "The specified key does not exist." "/usr/local/bin/minikube"; then - echo -e "\n(!) Failed to fetch the latest artifacts for minikube ${MINIKUBE_VERSION}..." - requested_version=$(get_previous_version "${repo_url}") - echo -e "\nAttempting to install ${requested_version}" - sudo curl -sSL -o /usr/local/bin/minikube "https://storage.googleapis.com/minikube/releases/${requested_version}/minikube-linux-${architecture}" - MINIKUBE_VERSION="${requested_version}" - fi -fi -sudo chmod 0755 /usr/local/bin/minikube -if [ "$MINIKUBE_SHA256" = "automatic" ]; then - MINIKUBE_SHA256="$(sudo curl -sSL "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-${architecture}.sha256")" -fi - ([ "${MINIKUBE_SHA256}" = "dev-mode" ] || (sudo echo "${MINIKUBE_SHA256} */usr/local/bin/minikube" | sha256sum -c -)) - if ! type minikube > /dev/null 2>&1; then - echo '(!) minikube installation failed!' - exit 1 - fi - -echo -e "\nšŸ‘‰${HL} minikube version as installed by this test for fallback installation${N}:" -set +e - check "minikube version" minikube version -set -e - -# Report result -reportResults diff --git a/test/kubectl-helm-minikube/scenarios.json b/test/kubectl-helm-minikube/scenarios.json index 6b3988f60..b82a9966e 100644 --- a/test/kubectl-helm-minikube/scenarios.json +++ b/test/kubectl-helm-minikube/scenarios.json @@ -9,16 +9,6 @@ } } }, - "install_only_kubectl_fallback": { - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", - "features": { - "kubectl-helm-minikube": { - "version": "latest", - "helm": "none", - "minikube": "none" - } - } - }, "install_only_helm_fallback": { "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "features": { @@ -28,15 +18,5 @@ "minikube": "none" } } - }, - "install_only_minikube_fallback": { - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", - "features": { - "kubectl-helm-minikube": { - "version": "none", - "helm": "none", - "minikube": "latest" - } - } } } From edd37b3070d8fd6abc57cbf2faeecc603fce78d4 Mon Sep 17 00:00:00 2001 From: gauravsaini04 <147703805+gauravsaini04@users.noreply.github.com> Date: Sat, 24 Feb 2024 04:46:38 +0000 Subject: [PATCH 4/6] bump the patch version --- src/kubectl-helm-minikube/devcontainer-feature.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kubectl-helm-minikube/devcontainer-feature.json b/src/kubectl-helm-minikube/devcontainer-feature.json index fa8ea6138..16472205f 100644 --- a/src/kubectl-helm-minikube/devcontainer-feature.json +++ b/src/kubectl-helm-minikube/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "kubectl-helm-minikube", - "version": "1.1.6", + "version": "1.1.7", "name": "Kubectl, Helm, and Minikube", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/kubectl-helm-minikube", "description": "Installs latest version of kubectl, Helm, and optionally minikube. Auto-detects latest versions and installs needed dependencies.", From 547bccb5b8cc019c5ad95681902f7b4bbc87d6a7 Mon Sep 17 00:00:00 2001 From: gauravsaini04 <147703805+gauravsaini04@users.noreply.github.com> Date: Tue, 27 Feb 2024 04:27:24 +0000 Subject: [PATCH 5/6] changes for last comments by @samruddhikhandale --- src/kubectl-helm-minikube/install.sh | 3 +-- test/kubectl-helm-minikube/install_only_helm_fallback.sh | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/kubectl-helm-minikube/install.sh b/src/kubectl-helm-minikube/install.sh index d88362fd8..bbba0692c 100755 --- a/src/kubectl-helm-minikube/install.sh +++ b/src/kubectl-helm-minikube/install.sh @@ -174,8 +174,7 @@ if [ ${HELM_VERSION} != "none" ]; then tmp_helm_filename="/tmp/helm/${helm_filename}" curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}" curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" - output=$(cat /tmp/helm/"${helm_filename}.asc") - if [[ "${output}" == *"Not Found"* ]]; then + if grep -q "BlobNotFound" "${tmp_helm_filename}"; then echo -e "\n(!) Failed to fetch the latest artifacts for helm ${HELM_VERSION}..." repo_url=https://api.github.com/repos/helm/helm/releases requested_version=$(get_previous_version "${repo_url}") diff --git a/test/kubectl-helm-minikube/install_only_helm_fallback.sh b/test/kubectl-helm-minikube/install_only_helm_fallback.sh index 56be9dcea..5459fe5d4 100644 --- a/test/kubectl-helm-minikube/install_only_helm_fallback.sh +++ b/test/kubectl-helm-minikube/install_only_helm_fallback.sh @@ -61,15 +61,15 @@ get_previous_version() { } latest_version=$(get_latest_version) -HELM_VERSION="$(change_patch_number ${latest_version} xyz)" +NON_EXISTING_PATCH_VERSION="xyz" +HELM_VERSION="$(change_patch_number ${latest_version} ${NON_EXISTING_PATCH_VERSION})" echo -e "\nšŸ‘‰${HL} Trying to install HELM_VERSION = ${HELM_VERSION}${N}"; sudo mkdir -p /tmp/helm helm_filename="helm-${HELM_VERSION}-linux-${architecture}.tar.gz" tmp_helm_filename="/tmp/helm/${helm_filename}" sudo curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}" sudo curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" -output=$(sudo cat /tmp/helm/"${helm_filename}.asc") -if [[ "${output}" == *"Not Found"* ]]; then +if grep -q "BlobNotFound" "/tmp/helm/${helm_filename}"; then echo -e "\n(!) Failed to fetch the latest artifacts for helm ${HELM_VERSION}..." requested_version=$(get_previous_version) echo -e "\nAttempting to install ${requested_version}" From 452f3a55924eec476863d40120d02da34060debf Mon Sep 17 00:00:00 2001 From: gauravsaini04 <147703805+gauravsaini04@users.noreply.github.com> Date: Tue, 27 Feb 2024 18:42:07 +0000 Subject: [PATCH 6/6] changes for suggestions --- src/kubectl-helm-minikube/install.sh | 18 ++++++++++-------- .../install_only_helm_fallback.sh | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/kubectl-helm-minikube/install.sh b/src/kubectl-helm-minikube/install.sh index bbba0692c..69d4e0237 100755 --- a/src/kubectl-helm-minikube/install.sh +++ b/src/kubectl-helm-minikube/install.sh @@ -162,6 +162,14 @@ get_previous_version() { curl -s "$repo_url" | jq -r 'del(.[].assets) | .[1].tag_name' } +get_helm() { + HELM_VERSION=$1 + helm_filename="helm-${HELM_VERSION}-linux-${architecture}.tar.gz" + tmp_helm_filename="/tmp/helm/${helm_filename}" + curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}" + curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" +} + if [ ${HELM_VERSION} != "none" ]; then # Install Helm, verify signature and checksum echo "Downloading Helm..." @@ -170,20 +178,14 @@ if [ ${HELM_VERSION} != "none" ]; then HELM_VERSION="v${HELM_VERSION}" fi mkdir -p /tmp/helm - helm_filename="helm-${HELM_VERSION}-linux-${architecture}.tar.gz" - tmp_helm_filename="/tmp/helm/${helm_filename}" - curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}" - curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" + get_helm "${HELM_VERSION}" if grep -q "BlobNotFound" "${tmp_helm_filename}"; then echo -e "\n(!) Failed to fetch the latest artifacts for helm ${HELM_VERSION}..." repo_url=https://api.github.com/repos/helm/helm/releases requested_version=$(get_previous_version "${repo_url}") echo -e "\nAttempting to install ${requested_version}" - helm_filename="helm-${requested_version}-linux-${architecture}.tar.gz" - tmp_helm_filename="/tmp/helm/${helm_filename}" - curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}" - curl -sSL "https://github.com/helm/helm/releases/download/${requested_version}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" HELM_VERSION=${requested_version} + get_helm "${HELM_VERSION}" fi export GNUPGHOME="/tmp/helm/gnupg" mkdir -p "${GNUPGHOME}" diff --git a/test/kubectl-helm-minikube/install_only_helm_fallback.sh b/test/kubectl-helm-minikube/install_only_helm_fallback.sh index 5459fe5d4..58ed137de 100644 --- a/test/kubectl-helm-minikube/install_only_helm_fallback.sh +++ b/test/kubectl-helm-minikube/install_only_helm_fallback.sh @@ -60,24 +60,26 @@ get_previous_version() { curl -s "$repo_url" | jq -r 'del(.[].assets) | .[1].tag_name' } +get_helm() { + HELM_VERSION=$1 + helm_filename="helm-${HELM_VERSION}-linux-${architecture}.tar.gz" + tmp_helm_filename="/tmp/helm/${helm_filename}" + sudo curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}" + sudo curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" +} + latest_version=$(get_latest_version) NON_EXISTING_PATCH_VERSION="xyz" HELM_VERSION="$(change_patch_number ${latest_version} ${NON_EXISTING_PATCH_VERSION})" echo -e "\nšŸ‘‰${HL} Trying to install HELM_VERSION = ${HELM_VERSION}${N}"; sudo mkdir -p /tmp/helm -helm_filename="helm-${HELM_VERSION}-linux-${architecture}.tar.gz" -tmp_helm_filename="/tmp/helm/${helm_filename}" -sudo curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}" -sudo curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" +get_helm "${HELM_VERSION}" if grep -q "BlobNotFound" "/tmp/helm/${helm_filename}"; then echo -e "\n(!) Failed to fetch the latest artifacts for helm ${HELM_VERSION}..." requested_version=$(get_previous_version) echo -e "\nAttempting to install ${requested_version}" - helm_filename="helm-${requested_version}-linux-${architecture}.tar.gz" - tmp_helm_filename="/tmp/helm/${helm_filename}" - sudo curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}" - sudo curl -sSL "https://github.com/helm/helm/releases/download/${requested_version}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc" HELM_VERSION=${requested_version} + get_helm "${HELM_VERSION}" fi export GNUPGHOME="/tmp/helm/gnupg" sudo mkdir -p "${GNUPGHOME}"