ci: update minikube only when latest is asked

Fixes: #1431
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
Prasanna Kumar Kalever 2020-08-25 21:45:50 +05:30 committed by mergify[bot]
parent 4ff60483ca
commit a44035888e

View File

@ -50,26 +50,26 @@ function detect_minikube() {
# install minikube # install minikube
function install_minikube() { function install_minikube() {
local mku_version latest_version if [[ "${MINIKUBE_VERSION}" == "latest" ]]; then
local mku_version
mku_version=$(${minikube} update-check 2> /dev/null | grep "LatestVersion" || true) mku_version=$(${minikube} update-check 2> /dev/null | grep "LatestVersion" || true)
latest_version=$(echo "${mku_version}" | cut -d' ' -f2) if [[ -n "${mku_version}" ]]; then
if [[ -z "${latest_version}" ]]; then MINIKUBE_VERSION=$(echo "${mku_version}" | cut -d' ' -f2)
# skip: update-check failed for some reason, lets continue with what we have
latest_version=${MINIKUBE_VERSION}
fi fi
fi
if type "${minikube}" >/dev/null 2>&1; then if type "${minikube}" >/dev/null 2>&1; then
local mk_version version local mk_version version
read -ra mk_version <<<"$(${minikube} version)" read -ra mk_version <<<"$(${minikube} version)"
version=${mk_version[2]} version=${mk_version[2]}
if [[ "${version}" == "${MINIKUBE_VERSION}" ]]; then
echo "minikube already installed with ${version}" echo "minikube already installed with ${version}"
if [[ "${version}" == "${latest_version}" ]]; then
echo "minikube is already the latest version"
return return
fi fi
fi fi
echo "Installing minikube. Version: ${latest_version}" echo "Installing minikube. Version: ${MINIKUBE_VERSION}"
curl -Lo minikube https://storage.googleapis.com/minikube/releases/"${latest_version}"/minikube-linux-"${MINIKUBE_ARCH}" && chmod +x minikube && mv minikube /usr/local/bin/ curl -Lo minikube https://storage.googleapis.com/minikube/releases/"${MINIKUBE_VERSION}"/minikube-linux-"${MINIKUBE_ARCH}" && chmod +x minikube && mv minikube /usr/local/bin/
} }
function detect_kubectl() { function detect_kubectl() {