Skip to content

Commit

Permalink
Log MCAD and InstaScale versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ronensc authored and openshift-merge-bot[bot] committed Nov 14, 2023
1 parent 6d4a5cd commit 32c6671
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 12 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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()

Expand Down

0 comments on commit 32c6671

Please sign in to comment.