Merge pull request #98309 from dims/ensure-bash-version-at-least-5.x

Ensure bash version at least 5.x
This commit is contained in:
Kubernetes Prow Robot 2021-01-23 22:02:53 -08:00 committed by GitHub
commit bfe42562a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -50,6 +50,7 @@ source "${KUBE_ROOT}/hack/lib/util.sh"
source "${KUBE_ROOT}/hack/lib/logging.sh"
kube::log::install_errexit
kube::util::ensure-bash-version
source "${KUBE_ROOT}/hack/lib/version.sh"
source "${KUBE_ROOT}/hack/lib/golang.sh"

View File

@ -729,6 +729,17 @@ function kube::util::ensure_dockerized {
fi
}
# kube::util::ensure-bash-version
# Check if we are using a supported bash version
#
function kube::util::ensure-bash-version {
# shellcheck disable=SC2004
if ((${BASH_VERSINFO[0]}<5)); then
echo "ERROR: This script requires a minimum bash version of 5.0"
exit 1
fi
}
# kube::util::ensure-gnu-sed
# Determines which sed binary is gnu-sed on linux/darwin
#