mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-13 05:02:50 +00:00
Improve generation of version information from the git tree
Detect whether the tree is dirty and append a "-dirty" indication to the git commit (common practice with other repos, e.g. kernel, docker.) Properly handle the case where a git tree is not found (e.g. building from archive.) In the sed expression, look for the variable to be updated (commitFromGit) instead of hardcoding a line number. Tested: - Built from a dirty tree: $ output/go/bin/kubelet -version Kubernetes version 0.1, build 2d784c684c75-dirty - Built from a clean tree: $ output/go/bin/kubelet -version Kubernetes version 0.1, build 505f23a31172 - Built from an archive: $ hack/build-go.sh WARNING: unable to find git commit, falling back to commitFromGit = `(none)` $ output/go/bin/kubelet -version Kubernetes version 0.1, build (none) Signed-off-by: Filipe Brandenburger <filbranden@google.com>
This commit is contained in:
@@ -19,5 +19,5 @@ package version
|
||||
// This file is the template for the machine-edited autogenerated.go.
|
||||
// Do not modify this file without also modifying hack/version-gen.sh.
|
||||
var (
|
||||
placeholder interface{}
|
||||
commitFromGit = `@@GIT_COMMIT@@`
|
||||
)
|
Reference in New Issue
Block a user