From 36aa8a24ce1d0f67681fb3d92582750a20057f45 Mon Sep 17 00:00:00 2001 From: llhuii Date: Wed, 13 Jan 2021 09:28:21 +0800 Subject: [PATCH] hack/lib/version.sh: fix error log to stderr Since this invalid Semantic Version messages redirecting to stdout will be captured by line 790 at hack/lib/golang.sh: `goldflags="${GOLDFLAGS=-s -w -buildid=} $(kube::version::ldflags)"` This happens when only no valid tag exists in repo --- hack/lib/version.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/lib/version.sh b/hack/lib/version.sh index 4dec8dadb4f..a14c7261aaa 100644 --- a/hack/lib/version.sh +++ b/hack/lib/version.sh @@ -108,8 +108,8 @@ kube::version::get_version_vars() { # 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. Current value: ${KUBE_GIT_VERSION}" - echo "Please see more details here: https://semver.org" + kube::log::error "KUBE_GIT_VERSION should be a valid Semantic Version. Current value: ${KUBE_GIT_VERSION}" + kube::log::error "Please see more details here: https://semver.org" exit 1 fi fi