build: Fix version generation.
This commit is contained in:
		@@ -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.
 | 
				
			||||||
 | 
					      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/")
 | 
					        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,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user