| Jan Schär | 36f3b6d | 2025-05-20 09:05:12 +0000 | [diff] [blame] | 1 | diff --git a/pkg/version/BUILD.bazel b/pkg/version/BUILD.bazel |
| 2 | index a0ab203..1514297 100644 |
| 3 | --- a/pkg/version/BUILD.bazel |
| 4 | +++ b/pkg/version/BUILD.bazel |
| 5 | @@ -7,6 +7,7 @@ go_library( |
| 6 | "doc.go", |
| 7 | "version.go", |
| 8 | ], |
| Tim Windelschmidt | e4264a3 | 2025-07-23 07:16:22 +0200 | [diff] [blame] | 9 | + embedsrcs = ["@monogon//build:kubernetes_stamp"], |
| Jan Schär | 36f3b6d | 2025-05-20 09:05:12 +0000 | [diff] [blame] | 10 | importpath = "k8s.io/client-go/pkg/version", |
| 11 | visibility = ["//visibility:public"], |
| 12 | deps = ["@io_k8s_apimachinery//pkg/version"], |
| 13 | diff --git a/pkg/version/base.go b/pkg/version/base.go |
| 14 | index 676d51d..c76789a 100644 |
| 15 | --- a/pkg/version/base.go |
| 16 | +++ b/pkg/version/base.go |
| 17 | @@ -16,6 +16,8 @@ limitations under the License. |
| 18 | |
| 19 | package version |
| 20 | |
| 21 | +import _ "embed" |
| 22 | + |
| 23 | // Base version information. |
| 24 | // |
| 25 | // This is the fallback data used when version information from git is not |
| 26 | @@ -39,8 +41,10 @@ var ( |
| 27 | // them irrelevant. (Next we'll take it out, which may muck with |
| 28 | // scripts consuming the kubectl version output - but most of |
| 29 | // these should be looking at gitVersion already anyways.) |
| 30 | - gitMajor string = "" // major version, always numeric |
| 31 | - gitMinor string = "" // minor version, numeric possibly followed by "+" |
| 32 | + //go:embed build/kubernetes_gitMajor.txt |
| 33 | + gitMajor string // major version, always numeric |
| 34 | + //go:embed build/kubernetes_gitMinor.txt |
| 35 | + gitMinor string // minor version, numeric possibly followed by "+" |
| 36 | |
| 37 | // semantic version, derived by build scripts (see |
| 38 | // https://github.com/kubernetes/sig-release/blob/master/release-engineering/versioning.md#kubernetes-release-versioning |
| 39 | @@ -56,9 +60,13 @@ var ( |
| 40 | // NOTE: The $Format strings are replaced during 'git archive' thanks to the |
| 41 | // companion .gitattributes file containing 'export-subst' in this same |
| 42 | // directory. See also https://git-scm.com/docs/gitattributes |
| 43 | - gitVersion string = "v0.0.0-master+$Format:%H$" |
| 44 | - gitCommit string = "$Format:%H$" // sha1 from git, output of $(git rev-parse HEAD) |
| 45 | - gitTreeState string = "" // state of git tree, either "clean" or "dirty" |
| 46 | + //go:embed build/kubernetes_gitVersion.txt |
| 47 | + gitVersion string |
| 48 | + //go:embed build/kubernetes_gitCommit.txt |
| 49 | + gitCommit string // sha1 from git, output of $(git rev-parse HEAD) |
| 50 | + //go:embed build/kubernetes_gitTreeState.txt |
| 51 | + gitTreeState string // state of git tree, either "clean" or "dirty" |
| 52 | |
| 53 | - buildDate string = "1970-01-01T00:00:00Z" // build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ') |
| 54 | + //go:embed build/kubernetes_buildDate.txt |
| 55 | + buildDate string // build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ') |
| 56 | ) |