Unverified Commit 54093041 authored by Mathiyarasy's avatar Mathiyarasy Committed by GitHub

kubectl version doesn't support vX.Y.Z (#1373)

* Fix issue when version is passed with v

* remove wcho command

* update version

* update test cases to check for specific versions
parent 66c73dfb
{ {
"id": "kubectl-helm-minikube", "id": "kubectl-helm-minikube",
"version": "1.2.1", "version": "1.2.2",
"name": "Kubectl, Helm, and Minikube", "name": "Kubectl, Helm, and Minikube",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/kubectl-helm-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.", "description": "Installs latest version of kubectl, Helm, and optionally minikube. Auto-detects latest versions and installs needed dependencies.",
......
...@@ -54,11 +54,12 @@ fi ...@@ -54,11 +54,12 @@ fi
find_version_from_git_tags() { find_version_from_git_tags() {
local variable_name=$1 local variable_name=$1
local requested_version=${!variable_name} local requested_version=${!variable_name}
requested_version="${requested_version#v}"
if [ "${requested_version}" = "none" ]; then return; fi if [ "${requested_version}" = "none" ]; then return; fi
local repository=$2 local repository=$2
local prefix=${3:-"tags/v"} local prefix=${3:-"tags/v"}
local separator=${4:-"."} 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 if [ "$(echo "${requested_version}" | grep -o "." | wc -l)" != "2" ]; then
local escaped_separator=${separator//./\\.} local escaped_separator=${separator//./\\.}
local last_part local last_part
......
#!/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
#!/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
...@@ -18,5 +18,25 @@ ...@@ -18,5 +18,25 @@
"minikube": "none" "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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment