forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add additional ldflags constants for Kubernetes versioning
Now it is possible to push these variables through ldflags: - gitMajor - gitMinor - gitVersion (from latest annotated tag, output of git describe) - gitCommit (renamed commitFromGit, intended to have the full sha1) - gitTreeState (either "clean" or "dirty") These are spawned into its separate source file, since they are meant to be updated separately when a new version is released. Also use the notation vX.Y+ for when git information is not present. (This is consistent with the kernel build, e.g. Linux 3.15+ means its version is >= 3.15 and < 3.16.) v2: Added comments to the individual fields in pkg/version/base.go Tested: - Built it and checked the -version output: $ hack/build-go.sh $ output/go/bin/kubelet -version Kubernetes version 0.1+, build c328679ef8aa Signed-off-by: Filipe Brandenburger <filbranden@google.com>
- Loading branch information
1 parent
7785f14
commit b777eb1
Showing
3 changed files
with
54 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
Copyright 2014 Google Inc. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package version | ||
|
||
// Base version information. | ||
// | ||
// This is the fallback data used when version information from git is not | ||
// provided via go ldflags. It provides an approximation of the Kubernetes | ||
// version for ad-hoc builds (e.g. `go build`) that cannot get the version | ||
// information from git. | ||
// | ||
// The "+" in the version info indicates that fact, and it means the current | ||
// build is from a version greater or equal to that version. | ||
// (e.g. v0.7+ means version >= 0.7 and < 0.8) | ||
// | ||
// When releasing a new Kubernetes version, this file should be updated to | ||
// reflect the new version, and then a git annotated tag (using format vX.Y | ||
// where X == Major version and Y == Minor version) should be created to point | ||
// to the commit that updates pkg/version/base.go | ||
|
||
var ( | ||
gitMajor string = "0" // major version, always numeric | ||
gitMinor string = "1+" // minor version, numeric possibly followed by "+" | ||
gitVersion string = "v0.1+" // version from git, output of $(git describe) | ||
gitCommit string = "" // sha1 from git, output of $(git rev-parse HEAD) | ||
gitTreeState string = "not a git tree" // state of git tree, either "clean" or "dirty" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters