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

Makefile: add bin/*, resolve and watch-resolve target 🚕 #2569

Merged
merged 2 commits into from
May 11, 2020
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ cmd/*/kodata/source.tar.gz
# binaries
test/pullrequest/pullrequest-init
/.bin/
/bin/
26 changes: 24 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,31 @@ $(BIN)/%: | $(BIN) ; $(info $(M) building $(PACKAGE)…)
|| ret=$$?; \
rm -rf $$tmp ; exit $$ret

FORCE:

bin/%: cmd/% FORCE
$(GO) build -mod=vendor $(LDFLAGS) -v -o $@ ./$<

KO = $(BIN)/ko
$(BIN)/ko: PACKAGE=github.com/google/ko/cmd/ko

.PHONY: apply
apply: | $(KO) ; $(info $(M) ko apply -f config/) @ ## Apply config to the current cluster
$Q $(KO) apply --strict -f config
$Q $(KO) apply -f config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove the --strict, is that intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and no 😅 With --strict, it doesn't build any image for me (for some weird reason).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--strict should only filter out things prefixed with ko://, so if you are seeing stuff that is prefixed not building we should talk :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattmoor just realized why… ko:// got temporarly remove because of ko-build/ko#164 I think 😝 hence why it doesn't build a thing 😝

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you could add the strict as an option?


.PHONY: resolve
resolve: | $(KO) ; $(info $(M) ko resolve -f config/) @ ## Resolve config to the current cluster
$Q $(KO) resolve --push=false --oci-layout-path=$(BIN)/oci -f config

.PHONY: generated
generated: | vendor ; $(info $(M) update generated files) ## Update generated files
$Q ./hack/update-codegen.sh

.PHONY: vendor
vendor:
$Q ./hack/update-deps.sh

## Tests
TEST_UNIT_TARGETS := test-unit-verbose test-unit-race
test-unit-verbose: ARGS=-v
test-unit-race: ARGS=-race
Expand Down Expand Up @@ -73,9 +91,13 @@ $(BIN)/ram: PACKAGE=github.com/vdemeester/ram
watch-test: | $(RAM) ; $(info $(M) watch and run tests) @ ## Watch and run tests
$Q $(RAM) -- -failfast

.PHONY: watch-resolve
watch-resolve: | $(KO) ; $(info $(M) watch and resolve config) @ ## Watch and build to the current cluster
$Q $(KO) resolve -W --push=false --oci-layout-path=$(BIN)/oci -f config 1>/dev/null

.PHONY: watch-config
watch-config: | $(KO) ; $(info $(M) watch and apply config) @ ## Watch and apply to the current cluster
$Q $(KO) apply --strict -W -f config
$Q $(KO) apply -W -f config

## Linters configuration and targets
# TODO(vdemeester) gofmt and goimports checks (run them with -w and make a diff)
Expand Down