Enable stamping and use correct variables
In D487 stamping was introduced, but not actually enabled. This enables it.
Kubernetes also uses "volatile" stamping variables for things that logic
depends on. This is a terrible idea because
you cannot unbreak a build since volatile stamps don't trigger a rebuild.
The status variables which are not purely informational have been changed
to "stable" variables
(see https://docs.bazel.build/versions/master/user-manual.html#flag--workspace_status_command).
Test Plan:
By itself not really testable, but has been tested on an
upcoming revision that actually depends on stamping behaving correctly.
X-Origin-Diff: phab/D491
GitOrigin-RevId: 48dda066d56e29d10fb0f0a88a845d8caf527c98
diff --git a/third_party/go/kubernetes_version_def.bzl b/third_party/go/kubernetes_version_def.bzl
index bb409bf..ddd1347 100644
--- a/third_party/go/kubernetes_version_def.bzl
+++ b/third_party/go/kubernetes_version_def.bzl
@@ -28,9 +28,12 @@
stamp_vars = [
"buildDate",
"gitCommit",
+ "gitTreeState",
+ ]
+
+ stable_stamp_vars = [
"gitMajor",
"gitMinor",
- "gitTreeState",
"gitVersion",
]
@@ -39,4 +42,7 @@
for pkg in stamp_pkgs:
for var in stamp_vars:
x_defs["%s.%s" % (pkg, var)] = "{KUBERNETES_%s}" % var
+ for pkg in stamp_pkgs:
+ for var in stable_stamp_vars:
+ x_defs["%s.%s" % (pkg, var)] = "{STABLE_KUBERNETES_%s}" % var
return x_defs