Skip to content

Commit

Permalink
Tiltfile: accept optional build tags
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
  • Loading branch information
joelanford committed Aug 30, 2024
1 parent 255e8f7 commit cd6c8ce
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN CGO_ENABLED=0 go install github.com/go-delve/delve/cmd/dlv@v${GO_VERSION}
)


def build_binary(repo, binary, image, debug=True):
def build_binary(repo, binary, image, tags="", debug=True):
gcflags = ''
if debug:
gcflags = "-gcflags 'all=-N -l'"
Expand All @@ -36,8 +36,8 @@ def build_binary(repo, binary, image, debug=True):
cmd='''
cd ../{repo}
mkdir -p .tiltbuild/bin
CGO_ENABLED=0 GOOS=linux go build {gcflags} -o .tiltbuild/bin/{binary} ./cmd/{binary}
'''.format(repo=repo, binary=binary, gcflags=gcflags),
CGO_ENABLED=0 GOOS=linux go build {tags} {gcflags} -o .tiltbuild/bin/{binary} ./cmd/{binary}
'''.format(repo=repo, binary=binary, gcflags=gcflags, tags=tags),
deps=['api', 'cmd/{}'.format(binary), 'internal', 'pkg', 'go.mod', 'go.sum']
)

Expand Down Expand Up @@ -138,13 +138,13 @@ def process_yaml(yaml):
# 'webhooks': 'rukpak-webhooks',
# },
# },
def deploy_repo(repo, data):
def deploy_repo(repo, data, tags="", debug=True):
print('Deploying repo {}'.format(repo))
deploy_cert_manager_if_needed()

local_port = data['starting_debug_port']
for binary, deployment in data['binaries'].items():
build_binary(repo, binary, data['image'])
build_binary(repo, binary, data['image'], tags, debug)
k8s_resource(deployment, port_forwards=['{}:30000'.format(local_port)])
local_port += 1
process_yaml(kustomize('../{}/{}'.format(repo, data['yaml'])))

0 comments on commit cd6c8ce

Please sign in to comment.