Commit 66a85555 authored by Piotr Skamruk's avatar Piotr Skamruk

build: Fix version generation.

parent 12b13357
...@@ -56,7 +56,14 @@ kube::version::get_version_vars() { ...@@ -56,7 +56,14 @@ kube::version::get_version_vars() {
# #
# TODO: We continue calling this "git version" because so many # TODO: We continue calling this "git version" because so many
# downstream consumers are expecting it there. # downstream consumers are expecting it there.
KUBE_GIT_VERSION=$(echo "${KUBE_GIT_VERSION}" | sed "s/-\([0-9]\{1,\}\)-g\([0-9a-f]\{14\}\)$/.\1\+\2/") DASHES_IN_VERSION=$(echo "${KUBE_GIT_VERSION}" | sed "s/[^-]//g")
if [[ "${DASHES_IN_VERSION}" == "---" ]] ; then
# We have distance to subversion (v1.1.0-subversion-1-gCommitHash)
KUBE_GIT_VERSION=$(echo "${KUBE_GIT_VERSION}" | sed "s/-\([0-9]\{1,\}\)-g\([0-9a-f]\{14\}\)$/.\1\+\2/")
elif [[ "${DASHES_IN_VERSION}" == "--" ]] ; then
# We have distance to base tag (v1.1.0-1-gCommitHash)
KUBE_GIT_VERSION=$(echo "${KUBE_GIT_VERSION}" | sed "s/-g\([0-9a-f]\{14\}\)$/+\1/")
fi
if [[ "${KUBE_GIT_TREE_STATE}" == "dirty" ]]; then if [[ "${KUBE_GIT_TREE_STATE}" == "dirty" ]]; then
# git describe --dirty only considers changes to existing files, but # git describe --dirty only considers changes to existing files, but
# that is problematic since new untracked .go files affect the build, # that is problematic since new untracked .go files affect the build,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment