github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/version/base.go (about)

     1  // Copyright © 2021 Alibaba Group Holding Ltd.
     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  
    15  package version
    16  
    17  // Base version information.
    18  //
    19  // This is the fallback data used when version information from git is not
    20  // provided via go ldflags. It provides an approximation of the Kubernetes
    21  // version for ad-hoc builds (e.g. `go build`) that cannot get the version
    22  // information from git.
    23  //
    24  // If you are looking at these fields in the git tree, they look
    25  // strange. They are modified on the fly by the build process. The
    26  // in-tree values are dummy values used for "git archive", which also
    27  // works for GitHub tar downloads.
    28  //
    29  // When releasing a new Kubernetes version, this file is updated by
    30  // build/mark_new_version.sh to reflect the new version, and then a
    31  // git annotated tag (using format vX.Y where X == Major version and Y
    32  // == Minor version) is created to point to the commit that updates
    33  // component-base/version/base.go
    34  var (
    35  	// TODO: Deprecate gitMajor and gitMinor, use only gitVersion
    36  	// instead. First step in deprecation, keep the fields but make
    37  	// them irrelevant. (Next we'll take it out, which may muck with
    38  	// scripts consuming the kubectl version output - but most of
    39  	// these should be looking at gitVersion already anyways.)
    40  	gitMajor string // major version, always numeric
    41  	gitMinor string // minor version, numeric possibly followed by "+"
    42  
    43  	// semantic version, derived by build scripts (see
    44  	// https://github.com/kubernetes/community/blob/master/contributors/design-proposals/release/versioning.md
    45  	// for a detailed discussion of this field)
    46  	//
    47  	// TODO: This field is still called "gitVersion" for legacy
    48  	// reasons. For prerelease versions, the build metadata on the
    49  	// semantic version is a git hash, but the version itself is no
    50  	// longer the direct output of "git describe", but a slight
    51  	// translation to be semver compliant.
    52  
    53  	// NOTE: The $Format strings are replaced during 'git archive' thanks to the
    54  	// companion .gitattributes file containing 'export-subst' in this same
    55  	// directory.  See also https://git-scm.com/docs/gitattributes
    56  	gitVersion = "latest"
    57  	gitCommit  = "" // sha1 from git, output of $(git rev-parse HEAD)
    58  
    59  	buildDate = "1970-01-01T00:00:00Z" // build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ')
    60  )