From 82de664248f444afcfec74a094c29f4414498b62 Mon Sep 17 00:00:00 2001 From: Anurag <81210977+kranurag7@users.noreply.github.com> Date: Thu, 11 Jan 2024 14:19:22 +0530 Subject: [PATCH] use ldflags during build this commit enables usage of ldflags during the build process. This is useful for getting the version in the logs via tilt UI. --- Tiltfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Tiltfile b/Tiltfile index 125050e64..0b51030f9 100644 --- a/Tiltfile +++ b/Tiltfile @@ -134,7 +134,6 @@ else: # Build CSO and add feature gates def deploy_cso(): - # yaml = str(kustomizesub("./hack/observability")) # build an observable kind deployment by default if settings.get("local_mode"): yaml = str(kustomizesub("./config/localmode")) else: @@ -146,11 +145,11 @@ def deploy_cso(): ) # Forge the build command - # ldflags = "-extldflags \"-static\" " + str(local("hack/version.sh")).rstrip("\n") + ldflags = "-extldflags \"-static\" " + str(local("hack/version.sh")).rstrip("\n") build_env = "CGO_ENABLED=0 GOOS=linux GOARCH=amd64" - build_cmd = "{build_env} go build -o .tiltbuild/manager cmd/main.go".format( + build_cmd = "{build_env} go build -ldflags '{ldflags}' -o .tiltbuild/manager cmd/main.go".format( build_env = build_env, - # ldflags = ldflags, + ldflags = ldflags, ) # Set up a local_resource build of the provider's manager binary. local_resource(