m/n/k/hyperkube: avoid unnecessary rebuilds

Previously, hyperkube was rebuilt each time a commit was made in the
monorepo. This change stops this by reading the variables from a
filtered stamp file instead. Now, only this filtered file is rebuilt
each time, which is very fast compared to linking hyperkube.

Previously, volatile status variables were used for gitTreeState and
buildDate. But the volatile status is bad for reproducibility, as it
makes Bazel intentionally use stale caches.  Instead, these variables
are now only defined in release builds, and left unstamped during
development. These variables are available at the /version endpoint of
the apiserver, so there may be some utility in defining them for release
builds, but they are not needed during development.

The buildDate is now taken from the commit date instead of
SOURCE_DATE_EPOCH, which simplifies the build process as we don't need
to define that variable anymore.

Previously, KUBERNETES_gitCommit was referenced but not defined by the
status script. It is now defined as the monorepo commit, which is more
useful than leaving it blank.

Change-Id: I6228888507e400ca1f53167ee9d4f132f5711a45
Reviewed-on: https://review.monogon.dev/c/monogon/+/4167
Tested-by: Jenkins CI
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
diff --git a/build/BUILD.bazel b/build/BUILD.bazel
new file mode 100644
index 0000000..20cfd57
--- /dev/null
+++ b/build/BUILD.bazel
@@ -0,0 +1,17 @@
+load("//build/filter_stamp:def.bzl", "filtered_stamp")
+
+# This is a filtered stable status file which contains only the variables which
+# do not change on every commit. Using this instead of the status file avoids
+# unnecessary rebuilds.
+filtered_stamp(
+    name = "stabler_status",
+    vars = [
+        "KUBERNETES_gitMajor",
+        "KUBERNETES_gitMinor",
+        "KUBERNETES_gitVersion",
+        "KUBERNETES_gitCommit",
+        "KUBERNETES_gitTreeState",
+        "KUBERNETES_buildDate",
+    ],
+    visibility = ["//visibility:public"],
+)