metropolis: replace version stamp with product info

This removes the stamped metropolis version library and the associated
stampgo infrastructure, and replaces it with the product info file.

The info is now stored in a separate file in the rootfs, instead of
embedded in the core binary. This has the benefit that the core binary
no longer needs to be relinked when stamping info changes.

The version logging in core/main, and the tconsole are updated to show
some of the additional info from the product info.

Change-Id: Ic5ed0e3598e8da71b96748e8d7abfedff41acd3f
Reviewed-on: https://review.monogon.dev/c/monogon/+/4207
Tested-by: Jenkins CI
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
diff --git a/metropolis/node/core/main.go b/metropolis/node/core/main.go
index 890a30b..2d80698 100644
--- a/metropolis/node/core/main.go
+++ b/metropolis/node/core/main.go
@@ -17,19 +17,18 @@
 	"source.monogon.dev/metropolis/node/core/localstorage/declarative"
 	"source.monogon.dev/metropolis/node/core/metrics"
 	"source.monogon.dev/metropolis/node/core/network"
+	"source.monogon.dev/metropolis/node/core/productinfo"
 	"source.monogon.dev/metropolis/node/core/roleserve"
 	"source.monogon.dev/metropolis/node/core/rpc/resolver"
 	"source.monogon.dev/metropolis/node/core/tconsole"
 	timesvc "source.monogon.dev/metropolis/node/core/time"
 	"source.monogon.dev/metropolis/node/core/update"
-	mversion "source.monogon.dev/metropolis/version"
 	"source.monogon.dev/osbase/bringup"
 	"source.monogon.dev/osbase/logtree"
 	"source.monogon.dev/osbase/net/dns"
 	"source.monogon.dev/osbase/supervisor"
 	"source.monogon.dev/osbase/sysctl"
 	"source.monogon.dev/osbase/tpm"
-	"source.monogon.dev/version"
 )
 
 func main() {
@@ -95,8 +94,17 @@
 func root(ctx context.Context) error {
 	logger := supervisor.Logger(ctx)
 
-	logger.Info("Starting Metropolis node init")
-	logger.Infof("Version: %s", version.Semver(mversion.Version))
+	productInfo := productinfo.Get()
+	logger.Infof("Starting %s init", productInfo.Info.Name)
+	logger.Infof("Version: %s", productInfo.VersionString)
+	logger.Infof("Variant: %s", productInfo.Info.Variant)
+	if productInfo.Info.BuildTreeDirty {
+		logger.Warning("Build tree dirty")
+	}
+	if productInfo.Info.CommitHash != "" {
+		logger.Infof("Commit: %s", productInfo.Info.CommitHash)
+		logger.Infof("Commit date: %s", productInfo.HumanCommitDate)
+	}
 
 	// Linux kernel default is 4096 which is far too low. Raise it to 1M which
 	// is what gVisor suggests.
@@ -198,8 +206,15 @@
 
 	// Initialize interactive consoles.
 	interactiveConsoles := []string{"/dev/tty0"}
+	consoleConfig := tconsole.Config{
+		Terminal:    tconsole.TerminalLinux,
+		LogTree:     supervisor.LogTree(ctx),
+		Network:     &networkSvc.Status,
+		Roles:       &rs.LocalRoles,
+		CuratorConn: &rs.CuratorConnection,
+	}
 	for _, c := range interactiveConsoles {
-		console, err := tconsole.New(tconsole.TerminalLinux, c, supervisor.LogTree(ctx), &networkSvc.Status, &rs.LocalRoles, &rs.CuratorConnection)
+		console, err := tconsole.New(consoleConfig, c)
 		if err != nil {
 			logger.Infof("Failed to initialize interactive console at %s: %v", c, err)
 		} else {