From dfde5f551ecf2f736a09b748123fe7ca9d50b33a 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 | 3 +++ pkg/version/version.go | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 pkg/version/version.go diff --git a/main.go b/main.go index 5ae73979..2d67188a 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" @@ -30,6 +31,8 @@ func main() { // set up signals so we handle the first shutdown signal gracefully ctx := signals.SetupSignalContext() + 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() if err != nil { 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 +)