treewide: fix nostamp
Previously, --nostamp did not disable all stamping with commit info,
which meant that metropolis e2e tests ran on CI even if no change was
made to metropolis code. Now, --config:nostamp does this properly.
The Bazel --nostamp flag is supposed to disable stamping. Ideally, this
means that the workspace status script is not executed. But we can't do
that because the metropolis version is required (e.g. for compatibility
checks), and we currently obtain the version from git tags. Another
option is to check whether the --nostamp flag is set in the status
script, and omit any git commit info in this case. But I didn't find a
way to access the --nostamp flag from the status script, so instead, the
--config:nostamp flag is introduced and replaces --nostamp.
Versions without git info are marked with a "-nostamp" suffix.
I adjusted //version to handle this case.
Change-Id: I34e1b59b908074e8d4234013358b6be41899570a
Reviewed-on: https://review.monogon.dev/c/monogon/+/4169
Tested-by: Jenkins CI
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
diff --git a/version/version.go b/version/version.go
index 999854e..2929684 100644
--- a/version/version.go
+++ b/version/version.go
@@ -33,6 +33,8 @@
if git.BuildTreeState != spec.Version_GitInformation_BUILD_TREE_STATE_CLEAN {
prerelease = append(prerelease, "dirty")
}
+ } else {
+ prerelease = append(prerelease, "nostamp")
}
if len(prerelease) > 0 {