forked from thanos-io/kube-thanos
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
60 lines (46 loc) · 2.05 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
JSONNET_FMT := jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s
CONTAINER_CMD:=docker run --rm \
-u="$(shell id -u):$(shell id -g)" \
-v "$(shell go env GOCACHE):/.cache/go-build" \
-v "$(PWD):/go/src/github.com/metalmatze/kube-thanos:Z" \
-w "/go/src/github.com/metalmatze/kube-thanos" \
-e USER=deadbeef \
-e GO111MODULE=on \
quay.io/coreos/jsonnet-ci
all: generate fmt
.PHONY: generate-in-docker
generate-in-docker:
@echo ">> Compiling assets and generating Kubernetes manifests"
$(CONTAINER_CMD) make $(MFLAGS) generate
.PHONY: generate
generate: manifests jsonnet/thanos-mixin/alerts.yaml jsonnet/thanos-mixin/rules.yaml dashboards **.md
**.md: $(shell find examples) build.sh example.jsonnet
embedmd -w `find . -name "*.md" | grep -v vendor`
manifests: vendor example.jsonnet build.sh
rm -rf manifests
./build.sh
dashboards: jsonnet/thanos-mixin/mixin.libsonnet jsonnet/thanos-mixin/config.libsonnet jsonnet/thanos-mixin/dashboards/*
@mkdir -p dashboards
jsonnet -J vendor -m dashboards jsonnet/thanos-mixin/dashboards.jsonnet
jsonnet/thanos-mixin/alerts.yaml: jsonnet/thanos-mixin/mixin.libsonnet jsonnet/thanos-mixin/config.libsonnet jsonnet/thanos-mixin/alerts/*
jsonnet jsonnet/thanos-mixin/alerts.jsonnet | gojsontoyaml > $@
jsonnet/thanos-mixin/rules.yaml: jsonnet/thanos-mixin/mixin.libsonnet jsonnet/thanos-mixin/config.libsonnet jsonnet/thanos-mixin/rules/*
jsonnet jsonnet/thanos-mixin/rules.jsonnet | gojsontoyaml > $@
vendor: jsonnetfile.json jsonnetfile.lock.json
rm -rf vendor
jb install
.PHONY: fmt
fmt:
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
xargs -n 1 -- $(JSONNET_FMT) -i
.PHONY: lint
lint: fmt jsonnet/thanos-mixin/alerts.yaml jsonnet/thanos-mixin/rules.yaml
promtool check rules jsonnet/thanos-mixin/alerts.yaml jsonnet/thanos-mixin/rules.yaml
.PHONY: test
test: jsonnet/thanos-mixin/alerts.yaml jsonnet/thanos-mixin/rules.yaml
promtool test rules tests.yaml
.PHONY: clean
clean:
rm -rf manifests/
rm -rf jsonnet/thanos-mixin/alerts.yaml
rm -rf dashboards/