From 3b8b9e6a24e9aaeafa7cc74c7efe0334e48b93ff Mon Sep 17 00:00:00 2001 From: Chen Zhiwei Date: Wed, 20 Dec 2017 17:24:36 +0800 Subject: [PATCH] Build Kubernetes binaries with valid Semantic Version --- hack/lib/version.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hack/lib/version.sh b/hack/lib/version.sh index f8cf2ea2b9..d6120d5a42 100644 --- a/hack/lib/version.sh +++ b/hack/lib/version.sh @@ -96,6 +96,13 @@ kube::version::get_version_vars() { KUBE_GIT_MINOR+="+" fi fi + + # If KUBE_GIT_VERSION is not a valid Semantic Version, then refuse to build. + if ! [[ "${KUBE_GIT_VERSION}" =~ ^v([0-9]+)\.([0-9]+)(\.[0-9]+)?(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then + echo "KUBE_GIT_VERSION should be a valid Semantic Version" + echo "Please see more details here: https://semver.org" + exit 1 + fi fi fi }