diff --git a/src/kubectl-helm-minikube/devcontainer-feature.json b/src/kubectl-helm-minikube/devcontainer-feature.json index 30c621f28..410a909e4 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.2.1", + "version": "1.2.2", "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.", diff --git a/src/kubectl-helm-minikube/install.sh b/src/kubectl-helm-minikube/install.sh index bf6c8f535..f0cf1c946 100755 --- a/src/kubectl-helm-minikube/install.sh +++ b/src/kubectl-helm-minikube/install.sh @@ -54,11 +54,12 @@ fi find_version_from_git_tags() { local variable_name=$1 local requested_version=${!variable_name} + requested_version="${requested_version#v}" if [ "${requested_version}" = "none" ]; then return; fi local repository=$2 local prefix=${3:-"tags/v"} local separator=${4:-"."} - local last_part_optional=${5:-"false"} + local last_part_optional=${5:-"false"} if [ "$(echo "${requested_version}" | grep -o "." | wc -l)" != "2" ]; then local escaped_separator=${separator//./\\.} local last_part diff --git a/test/kubectl-helm-minikube/install_kubectl_with_version.sh b/test/kubectl-helm-minikube/install_kubectl_with_version.sh new file mode 100644 index 000000000..6e0608f59 --- /dev/null +++ b/test/kubectl-helm-minikube/install_kubectl_with_version.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +# Define expected versions +KUBECTL_EXPECTED_VERSION="v1.33.0" +HELM_VERSION="v3.17.3" +MINIKUBE_VERSION="v1.31.1" + +set +e + kubectl version --client --output json | jq -r '.clientVersion.gitVersion' | grep "${KUBECTL_VERSION}" + exit_code=$? + check "kubectl-version-${KUBECTL_VERSION}-installed" bash -c "echo ${exit_code} | grep 0" + echo "kubectl version:" + kubectl version --client + + helm version --short | grep "${HELM_VERSION}" + exit_code=$? + check "helm-version-${HELM_VERSION}-installed" bash -c "echo ${exit_code} | grep 0" + echo "helm version:" + helm version --short + + minikube version --short | grep "${MINIKUBE_VERSION}" + exit_code=$? + check "minikube-version-${MINIKUBE_VERSION}-installed" bash -c "echo ${exit_code} | grep 0" + echo "minikube version:" + minikube version --short +set -e + +# Report result +reportResults \ No newline at end of file diff --git a/test/kubectl-helm-minikube/install_kubectl_without_version.sh b/test/kubectl-helm-minikube/install_kubectl_without_version.sh new file mode 100644 index 000000000..8a73ff599 --- /dev/null +++ b/test/kubectl-helm-minikube/install_kubectl_without_version.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +# Define expected versions +KUBECTL_EXPECTED_VERSION="1.30" +HELM_VERSION="3.16" +MINIKUBE_VERSION="1.28" + +set +e + kubectl version --client --output json | jq -r '.clientVersion.gitVersion' | grep "${KUBECTL_VERSION}" + exit_code=$? + check "kubectl-version-${KUBECTL_VERSION}-installed" bash -c "echo ${exit_code} | grep 0" + echo "kubectl version:" + kubectl version --client + + helm version --short | grep "${HELM_VERSION}" + exit_code=$? + check "helm-version-${HELM_VERSION}-installed" bash -c "echo ${exit_code} | grep 0" + echo "helm version:" + helm version --short + + minikube version --short | grep "${MINIKUBE_VERSION}" + exit_code=$? + check "minikube-version-${MINIKUBE_VERSION}-installed" bash -c "echo ${exit_code} | grep 0" + echo "minikube version:" + minikube version --short +set -e + +# Report result +reportResults \ No newline at end of file diff --git a/test/kubectl-helm-minikube/scenarios.json b/test/kubectl-helm-minikube/scenarios.json index b82a9966e..f18ce0756 100644 --- a/test/kubectl-helm-minikube/scenarios.json +++ b/test/kubectl-helm-minikube/scenarios.json @@ -18,5 +18,25 @@ "minikube": "none" } } + }, + "install_kubectl_without_version": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "features": { + "kubectl-helm-minikube": { + "version": "1.30", + "helm": "3.16", + "minikube": "1.28" + } + } + }, + "install_kubectl_with_version": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "features": { + "kubectl-helm-minikube": { + "version": "v1.33.0", + "helm": "v3.17.3", + "minikube": "v1.31.1" + } + } } -} +} \ No newline at end of file