From 32c66716ec87bcfcdf0ddf904febd198253c5499 Mon Sep 17 00:00:00 2001 From: Ronen Schaffer Date: Tue, 14 Nov 2023 11:53:54 +0200 Subject: [PATCH] Log MCAD and InstaScale versions --- Makefile | 9 ++++++++- main.go | 17 ++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 564fbb078..7d647462e 100644 --- a/Makefile +++ b/Makefile @@ -159,7 +159,14 @@ modules: ## Update Go dependencies. .PHONY: build build: modules fmt vet ## Build manager binary. - go build -ldflags "-X 'main.BuildVersion=$(BUILD_VERSION)' -X 'main.BuildDate=$(BUILD_DATE)'" -o bin/manager main.go + go build \ + -ldflags " \ + -X 'main.OperatorVersion=$(BUILD_VERSION)' \ + -X 'main.McadVersion=$(MCAD_VERSION)' \ + -X 'main.InstaScaleVersion=$(INSTASCALE_VERSION)' \ + -X 'main.BuildDate=$(BUILD_DATE)' \ + " \ + -o bin/manager main.go .PHONY: run run: modules manifests fmt vet ## Run a controller from your host. diff --git a/main.go b/main.go index 6387f18f7..84827f43c 100644 --- a/main.go +++ b/main.go @@ -58,10 +58,12 @@ import ( ) var ( - scheme = runtime.NewScheme() - setupLog = ctrl.Log.WithName("setup") - BuildVersion = "UNKNOWN" - BuildDate = "UNKNOWN" + scheme = runtime.NewScheme() + setupLog = ctrl.Log.WithName("setup") + OperatorVersion = "UNKNOWN" + McadVersion = "UNKNOWN" + InstaScaleVersion = "UNKNOWN" + BuildDate = "UNKNOWN" ) func init() { @@ -87,7 +89,12 @@ func main() { zapOptions.BindFlags(flag.CommandLine) ctrl.SetLogger(zap.New(zap.UseFlagOptions(&zapOptions))) - setupLog.Info("Build info", "version", BuildVersion, "date", BuildDate) + setupLog.Info("Build info", + "operatorVersion", OperatorVersion, + "mcadVersion", McadVersion, + "instaScaleVersion", InstaScaleVersion, + "date", BuildDate, + ) ctx := ctrl.SetupSignalHandler()