From 0bfa351eb49317904e3156e11a8e9cae48fd6a42 Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Thu, 1 Oct 2020 17:23:37 -0700 Subject: [PATCH] Do not append "-dirty" to the version number when the git repo is dirty - Semver version numbers do not end with "-dirty" - Continue to include the clean/dirty status of the repo in the `gitTreeState` field --- hack/lib/version.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/hack/lib/version.sh b/hack/lib/version.sh index 04d61d17..55bf97b3 100644 --- a/hack/lib/version.sh +++ b/hack/lib/version.sh @@ -38,9 +38,10 @@ kube::version::get_version_vars() { fi fi - # If KUBE_GIT_VERSION is supplied and is not a valid Semantic Version, then refuse to build. + # If KUBE_GIT_VERSION is supplied if [[ -n "${KUBE_GIT_VERSION:-""}" ]]; then + # 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 starting with a \"v\". Current value: ${KUBE_GIT_VERSION}" echo "Please see more details here: https://semver.org" @@ -52,13 +53,6 @@ kube::version::get_version_vars() { KUBE_GIT_MINOR=${BASH_REMATCH[2]} fi - if [[ "${KUBE_GIT_TREE_STATE}" == "dirty" ]]; then - # git describe --dirty only considers changes to existing files, but - # that is problematic since new untracked .go files affect the build, - # so use our idea of "dirty" from git status instead. - KUBE_GIT_VERSION+="-dirty" - fi - else # KUBE_GIT_VERSION was not supplied KUBE_GIT_VERSION='?.?.?'