Makefile: remove containerized tooling
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
This commit is contained in:
67
Makefile
67
Makefile
@@ -1,66 +1,53 @@
|
|||||||
SHELL=/bin/bash -o pipefail
|
SHELL=/bin/bash -o pipefail
|
||||||
|
|
||||||
JSONNET_ARGS := -n 2 --max-blank-lines 2 --string-style s --comment-style s
|
BIN_DIR?=$(shell pwd)/tmp/bin
|
||||||
ifneq (,$(shell which jsonnetfmt))
|
|
||||||
JSONNET_FMT_CMD := jsonnetfmt
|
|
||||||
else
|
|
||||||
JSONNET_FMT_CMD := jsonnet
|
|
||||||
JSONNET_FMT_ARGS := fmt $(JSONNET_ARGS)
|
|
||||||
endif
|
|
||||||
JSONNET_FMT := $(JSONNET_FMT_CMD) $(JSONNET_FMT_ARGS)
|
|
||||||
|
|
||||||
FIRST_GOPATH:=$(firstword $(subst :, ,$(shell go env GOPATH)))
|
EMBEDMD_BIN=$(BIN_DIR)/embedmd
|
||||||
JB_BINARY:=$(FIRST_GOPATH)/bin/jb
|
JB_BIN=$(BIN_DIR)/jb
|
||||||
EMBEDMD_BINARY := embedmd
|
GOJSONTOYAML_BIN=$(BIN_DIR)/gojsontoyaml
|
||||||
CONTAINER_CMD:=docker run --rm \
|
JSONNET_BIN=$(BIN_DIR)/jsonnet
|
||||||
-e http_proxy -e https_proxy -e no_proxy \
|
JSONNETFMT_BIN=$(BIN_DIR)/jsonnetfmt
|
||||||
-u="$(shell id -u):$(shell id -g)" \
|
TOOLING=$(EMBEDMD_BIN) $(JB_BIN) $(GOJSONTOYAML_BIN) $(JSONNET_BIN) $(JSONNETFMT_BIN)
|
||||||
-v "$(shell go env GOCACHE):/.cache/go-build" \
|
|
||||||
-v "$(PWD):/go/src/github.com/coreos/kube-prometheus:Z" \
|
JSONNETFMT_ARGS=-n 2 --max-blank-lines 2 --string-style s --comment-style s
|
||||||
-w "/go/src/github.com/coreos/kube-prometheus" \
|
|
||||||
quay.io/coreos/jsonnet-ci
|
|
||||||
|
|
||||||
all: generate fmt test
|
all: generate fmt test
|
||||||
|
|
||||||
.PHONY: generate-in-docker
|
|
||||||
generate-in-docker:
|
|
||||||
@echo ">> Compiling assets and generating Kubernetes manifests"
|
|
||||||
$(CONTAINER_CMD) make $(MFLAGS) generate
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
# Remove all files and directories ignored by git.
|
# Remove all files and directories ignored by git.
|
||||||
git clean -Xfd .
|
git clean -Xfd .
|
||||||
|
|
||||||
|
.PHONY: generate
|
||||||
generate: manifests **.md
|
generate: manifests **.md
|
||||||
|
|
||||||
**.md: $(shell find examples) build.sh example.jsonnet
|
**.md: $(EMBEDMD_BIN) $(shell find examples) build.sh example.jsonnet
|
||||||
$(EMBEDMD_BINARY) -w `find . -name "*.md" | grep -v vendor`
|
$(EMBEDMD_BIN) -w `find . -name "*.md" | grep -v vendor`
|
||||||
|
|
||||||
manifests: examples/kustomize.jsonnet vendor build.sh
|
manifests: examples/kustomize.jsonnet $(GOJSONTOYAML_BIN) vendor build.sh
|
||||||
rm -rf manifests
|
|
||||||
./build.sh $<
|
./build.sh $<
|
||||||
|
|
||||||
vendor: $(JB_BINARY) jsonnetfile.json jsonnetfile.lock.json
|
vendor: $(JB_BIN) jsonnetfile.json jsonnetfile.lock.json
|
||||||
rm -rf vendor
|
rm -rf vendor
|
||||||
$(JB_BINARY) install
|
$(JB_BIN) install
|
||||||
|
|
||||||
fmt:
|
.PHONY: fmt
|
||||||
|
fmt: $(JSONNETFMT_BIN)
|
||||||
find . -name 'vendor' -prune -o -name '*.libsonnet' -o -name '*.jsonnet' -print | \
|
find . -name 'vendor' -prune -o -name '*.libsonnet' -o -name '*.jsonnet' -print | \
|
||||||
xargs -n 1 -- $(JSONNET_FMT) -i
|
xargs -n 1 -- $(JSONNETFMT_BIN) $(JSONNETFMT_ARGS) -i
|
||||||
|
|
||||||
test: $(JB_BINARY)
|
.PHONY: test
|
||||||
$(JB_BINARY) install
|
test: $(JB_BIN)
|
||||||
|
$(JB_BIN) install
|
||||||
./test.sh
|
./test.sh
|
||||||
|
|
||||||
|
.PHONY: test-e2e
|
||||||
test-e2e:
|
test-e2e:
|
||||||
go test -timeout 55m -v ./tests/e2e -count=1
|
go test -timeout 55m -v ./tests/e2e -count=1
|
||||||
|
|
||||||
test-in-docker:
|
$(BIN_DIR):
|
||||||
@echo ">> Compiling assets and generating Kubernetes manifests"
|
mkdir -p $(BIN_DIR)
|
||||||
$(CONTAINER_CMD) make $(MFLAGS) test
|
|
||||||
|
|
||||||
.PHONY: generate generate-in-docker test test-in-docker fmt
|
$(TOOLING): $(BIN_DIR)
|
||||||
|
@echo Installing tools from scripts/tools.go
|
||||||
$(JB_BINARY):
|
@cd scripts && cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go build -o $(BIN_DIR) %
|
||||||
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.3.1
|
|
||||||
|
|||||||
Reference in New Issue
Block a user