[#1851] fix hack/version.sh incorrect git version

This commit is contained in:
King Jin 2023-05-27 12:41:10 +08:00
parent 3367bfcc18
commit 4327920cb4
No known key found for this signature in database
GPG Key ID: C249A45119231E33

View File

@ -33,7 +33,7 @@ version::get_version_vars() {
# stolen from k8s.io/hack/lib/version.sh
# Use git describe to find the version based on annotated tags.
if [[ -n ${GIT_VERSION-} ]] || GIT_VERSION=$(git describe --abbrev=14 --match "v[0-9]*" 2>/dev/null); then
if [[ -n ${GIT_VERSION-} ]] || GIT_VERSION=$(git describe --tags --abbrev=14 --match "v[0-9]*" "${GIT_COMMIT}" 2>/dev/null); then
# This translates the "git describe" to an actual semver.org
# compatible semantic version that looks something like this:
# v1.1.0-alpha.0.6+84c76d1142ea4d