Skip to content

Commit

Permalink
use ldflags during build
Browse files Browse the repository at this point in the history
this commit enables usage of ldflags during the build process. This is
useful for getting the version in the logs via tilt UI.

Signed-off-by: Anurag <anurag.kumar@syself.com>
  • Loading branch information
kranurag7 authored and Anurag committed Jan 11, 2024
1 parent 6de6c0c commit 795823b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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(
Expand Down

0 comments on commit 795823b

Please sign in to comment.