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