Browse code

Correctly parse git versions with longer short hashes

Dan Winship authored on 2016/10/06 01:31:55
Showing 1 changed files
... ...
@@ -693,7 +693,7 @@ function os::build::os_version_vars() {
693 693
       #
694 694
       # TODO: We continue calling this "git version" because so many
695 695
       # downstream consumers are expecting it there.
696
-      OS_GIT_VERSION=$(echo "${OS_GIT_VERSION}" | sed "s/-\([0-9]\{1,\}\)-g\([0-9a-f]\{7\}\)$/\+\2/")
696
+      OS_GIT_VERSION=$(echo "${OS_GIT_VERSION}" | sed "s/-\([0-9]\{1,\}\)-g\([0-9a-f]\{7,40\}\)$/\+\2/")
697 697
       if [[ "${OS_GIT_TREE_STATE}" == "dirty" ]]; then
698 698
         # git describe --dirty only considers changes to existing files, but
699 699
         # that is problematic since new untracked .go files affect the build,
... ...
@@ -724,7 +724,7 @@ function os::build::kube_version_vars() {
724 724
   #
725 725
   # TODO: We continue calling this "git version" because so many
726 726
   # downstream consumers are expecting it there.
727
-  KUBE_GIT_VERSION=$(echo "${KUBE_GIT_VERSION}" | sed "s/-\([0-9]\{1,\}\)-g\([0-9a-f]\{7\}\)$/\+\2/")
727
+  KUBE_GIT_VERSION=$(echo "${KUBE_GIT_VERSION}" | sed "s/-\([0-9]\{1,\}\)-g\([0-9a-f]\{7,40\}\)$/\+\2/")
728 728
 
729 729
   # Try to match the "git describe" output to a regex to try to extract
730 730
   # the "major" and "minor" versions and whether this is the exact tagged