Fix makefile to install utilities when not present

This commit is contained in:
CarlosEDP 2019-03-13 18:04:19 -03:00
parent eb9320fd55
commit 2d042dcd50

View File

@ -4,25 +4,23 @@ JB_BINARY:=$(GOPATH)/bin/jb
.PHONY: generate vendor fmt manifests .PHONY: generate vendor fmt manifests
all: generate all: manifests
generate: manifests manifests: jsonnet
manifests: $(JSONNET)
rm -rf manifests rm -rf manifests
./scripts/build.sh main.jsonnet ./scripts/build.sh main.jsonnet
update: update:
jb update jb update
vendor: $(JB_BINARY) jsonnetfile.json jsonnetfile.lock.json vendor: jsonnet_bundler jsonnetfile.json jsonnetfile.lock.json
rm -rf vendor rm -rf vendor
$(JB_BINARY) install $(JB_BINARY) install
fmt: fmt:
find . -name 'vendor' -prune -o -name '*.libsonnet' -o -name '*.jsonnet' -print | xargs -n 1 -- $(JSONNET_FMT) -i find . -name 'vendor' -prune -o -name '*.libsonnet' -o -name '*.jsonnet' -print | xargs -n 1 -- $(JSONNET_FMT) -i
deploy: deploy: manifests
kubectl apply -f ./manifests/ kubectl apply -f ./manifests/
echo "Will wait 40 seconds to reapply manifests" echo "Will wait 40 seconds to reapply manifests"
sleep 40 sleep 40
@ -35,9 +33,16 @@ tar: manifests
rm -rf manifests.tar rm -rf manifests.tar
tar -cf manifests.tar manifests tar -cf manifests.tar manifests
$(JB_BINARY): jsonnet_bundler:
go get -u github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb ifeq (, $(shell which jb))
@echo "Installing jsonnet-bundler"
@go get -u github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
@go get github.com/brancz/gojsontoyaml
endif
$(JSONNET): jsonnet:
go get github.com/google/go-jsonnet/jsonnet ifeq (, $(shell which jsonnet))
go get github.com/brancz/gojsontoyaml @echo "Installing jsonnet"
@go get github.com/google/go-jsonnet/jsonnet
@go get github.com/brancz/gojsontoyaml
endif