github.heygears.com/openimsdk/tools@v0.0.49/version/base.go (about) 1 // Copyright © 2023 OpenIM. All rights reserved. 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 var ( 34 // TODO: Deprecate gitMajor and gitMinor, use only gitVersion 35 // instead. First step in deprecation, keep the fields but make 36 // them irrelevant. (Next we'll take it out, which may muck with 37 // scripts consuming the kubectl version output - but most of 38 // these should be looking at gitVersion already anyways.) 39 gitMajor string = "" // major version, always numeric 40 gitMinor string = "" // minor version, numeric possibly followed by "+" 41 42 // Semantic version, derived by build scripts (see 43 // https://github.com/kubernetes/sig-release/blob/master/release-engineering/versioning.md#kubernetes-release-versioning 44 // https://kubernetes.io/releases/version-skew-policy/ 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 string = "latest" 57 gitCommit string = "" // sha1 from git, output of $(git rev-parse HEAD) 58 gitTreeState string = "" // state of git tree, either "clean" or "dirty" 59 60 buildDate string = "1970-01-01T00:00:00Z" // build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ') 61 )