Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scripts to build kpack with Tilt #1345

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
print('Hello Tiltfile')

load('ext://pack', 'pack')
update_settings( max_parallel_updates = 5, k8s_upsert_timeout_secs = 200 )

pack('controller',
deps = ['./cmd/controller/build'],
live_update = [ sync('./cmd/controller/build', '/tmp/tilt'),
run('cp -rf /tmp/tilt/* /layers/paketo-buildpacks_go-build/targets/bin', trigger=['./cmd/controller/build']),
],
env_vars=['BP_GO_TARGETS=./cmd/controller', 'BP_LIVE_RELOAD_ENABLED=true']
)
pack('webhook',
deps = ['./cmd/webhook/build'],
live_update = [ sync('./cmd/webhook/build', '/tmp/tilt'),
run('cp -rf /tmp/tilt/* /layers/paketo-buildpacks_go-build/targets/bin', trigger=['./cmd/webhook/build']),
],
env_vars=['BP_GO_TARGETS=./cmd/webhook', 'BP_LIVE_RELOAD_ENABLED=true']
)
pack('build-init',
deps = ['./cmd/build-init/build'],
live_update = [ sync('./cmd/build-init/build', '/tmp/tilt'),
run('cp -rf /tmp/tilt/* /layers/paketo-buildpacks_go-build/targets/bin', trigger=['./cmd/build-init/build']),
],
env_vars=['BP_GO_TARGETS=./cmd/build-init', 'BP_LIVE_RELOAD_ENABLED=true']
)
pack('build-waiter',
deps = ['./cmd/build-waiter/build'],
live_update = [ sync('./cmd/build-waiter/build', '/tmp/tilt'),
run('cp -rf /tmp/tilt/* /layers/paketo-buildpacks_go-build/targets/bin', trigger=['./cmd/build-waiter/build']),
],
env_vars=['BP_GO_TARGETS=./cmd/build-waiter', 'BP_LIVE_RELOAD_ENABLED=true']
)
pack('rebase',
deps = ['./cmd/rebase/build'],
live_update = [ sync('./cmd/rebase/build', '/tmp/tilt'),
run('cp -rf /tmp/tilt/* /layers/paketo-buildpacks_go-build/targets/bin', trigger=['./cmd/rebase/build']),
],
env_vars=['BP_GO_TARGETS=./cmd/rebase', 'BP_LIVE_RELOAD_ENABLED=true']
)
pack('completion',
deps = ['./cmd/completion/build'],
live_update = [ sync('./cmd/completion/build', '/tmp/tilt'),
run('cp -rf /tmp/tilt/* /layers/paketo-buildpacks_go-build/targets/bin/', trigger=['./cmd/completion/build']),
],
env_vars=['BP_GO_TARGETS=./cmd/completion', 'BP_LIVE_RELOAD_ENABLED=true']
)


local_resource('controller',
cmd='GOOS=linux GOARCH=amd64 go build -o build/ -buildmode pie .',
deps=['./cmd/controller'],
ignore=['./cmd/controller/build'],
dir='./cmd/controller'
)

local_resource('webhook',
cmd='GOOS=linux GOARCH=amd64 go build -o build/ -buildmode pie .',
deps=['./cmd/webhook'],
ignore=['./cmd/webhook/build'],
dir='./cmd/webhook'
)

local_resource('build-init',
cmd='GOOS=linux GOARCH=amd64 go build -o build/ -buildmode pie .',
deps=['./cmd/build-init'],
ignore=['./cmd/build-init/build'],
dir='./cmd/build-init'
)

local_resource('build-waiter',
cmd='GOOS=linux GOARCH=amd64 go build -o build/ -buildmode pie .',
deps=['./cmd/build-waiter'],
ignore=['./cmd/build-waiter/build'],
dir='./cmd/build-waiter'
)

local_resource('rebase',
cmd='GOOS=linux GOARCH=amd64 go build -o build/ -buildmode pie .',
deps=['./cmd/rebase'],
ignore=['./cmd/rebase/build'],
dir='./cmd/rebase'
)

local_resource('completion',
cmd='GOOS=linux GOARCH=amd64 go build -o build/ -buildmode pie .',
deps=['./cmd/completion'],
ignore=['./cmd/completion/build'],
dir='./cmd/completion'
)

ytt_text = local('./hack/deploytilt.sh')

k8s_yaml(ytt_text)

k8s_kind('ConfigMap', image_json_path='{.data.image}', pod_readiness='ignore')
7 changes: 7 additions & 0 deletions hack/deploytilt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

sed -i -e 's/^/#/' config/config-logging.yaml

export KPACK_lifecycle__image="gcr.io/cf-build-service-public/kpack/lifecycle"

ytt -f config/ --data-values-env-yaml KPACK