From 31903e6b004386a78b1c35740be1c367122c24af Mon Sep 17 00:00:00 2001 From: yiannistri <8741709+yiannistri@users.noreply.github.com> Date: Thu, 9 Jan 2025 14:20:34 +0000 Subject: [PATCH] fix: Print build commit SHA during startup (cherry picked from commit 472dc2a7dfc30ebc452691937def1e2eae793f02) --- main.go | 2 ++ pkg/version/version.go | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 pkg/version/version.go diff --git a/main.go b/main.go index d0d3b159..89cbb5c4 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( "github.com/rancher/aks-operator/controller" aksv1 "github.com/rancher/aks-operator/pkg/generated/controllers/aks.cattle.io" + "github.com/rancher/aks-operator/pkg/version" core3 "github.com/rancher/wrangler/v3/pkg/generated/controllers/core" "github.com/rancher/wrangler/v3/pkg/kubeconfig" "github.com/rancher/wrangler/v3/pkg/signals" @@ -36,6 +37,7 @@ func main() { logrus.SetLevel(logrus.DebugLevel) logrus.Debugf("Loglevel set to [%v]", logrus.DebugLevel) } + logrus.Infof("Starting aks-operator (version: %s, commit: %s)", version.Version, version.GitCommit) // This will load the kubeconfig file in a style the same as kubectl cfg, err := kubeconfig.GetNonInteractiveClientConfig(kubeconfigFile).ClientConfig() diff --git a/pkg/version/version.go b/pkg/version/version.go new file mode 100644 index 00000000..5a40ac92 --- /dev/null +++ b/pkg/version/version.go @@ -0,0 +1,6 @@ +package version + +var ( + GitCommit string + Version string +)