base.go 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package version
  15. // Base version information.
  16. //
  17. // This is the fallback data used when version information from git is not
  18. // provided via go ldflags. It provides an approximation of the Kubernetes
  19. // version for ad-hoc builds (e.g. `go build`) that cannot get the version
  20. // information from git.
  21. //
  22. // If you are looking at these fields in the git tree, they look
  23. // strange. They are modified on the fly by the build process. The
  24. // in-tree values are dummy values used for "git archive", which also
  25. // works for GitHub tar downloads.
  26. //
  27. // When releasing a new Kubernetes version, this file is updated by
  28. // build/mark_new_version.sh to reflect the new version, and then a
  29. // git annotated tag (using format vX.Y where X == Major version and Y
  30. // == Minor version) is created to point to the commit that updates
  31. // pkg/version/base.go
  32. var (
  33. // TODO: Deprecate gitMajor and gitMinor, use only gitVersion
  34. // instead. First step in deprecation, keep the fields but make
  35. // them irrelevant. (Next we'll take it out, which may muck with
  36. // scripts consuming the kubectl version output - but most of
  37. // these should be looking at gitVersion already anyways.)
  38. gitMajor string = "1" // major version, always numeric
  39. gitMinor string = "6" // minor version, numeric possibly followed by "+"
  40. // semantic version, derived by build scripts (see
  41. // https://github.com/kubernetes/kubernetes/blob/master/docs/design/versioning.md
  42. // for a detailed discussion of this field)
  43. //
  44. // TODO: This field is still called "gitVersion" for legacy
  45. // reasons. For prerelease versions, the build metadata on the
  46. // semantic version is a git hash, but the version itself is no
  47. // longer the direct output of "git describe", but a slight
  48. // translation to be semver compliant.
  49. gitVersion string = "v1.6.2+$Format:%h$"
  50. gitCommit string = "$Format:%H$" // sha1 from git, output of $(git rev-parse HEAD)
  51. gitTreeState string = "not a git tree" // state of git tree, either "clean" or "dirty"
  52. gitBranch string = "unknown"
  53. buildDate string = "1970-01-01T00:00:00Z" // build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ')
  54. )