-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (26 loc) · 1.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
JSONNET_FMT := jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s
JSONNET_LINT := jsonnet-lint
all: fmt prometheus_alerts.yaml check yamlfmt test
setup_jsonnet:
bash setup_jsonnet.sh
setup:
go get -u github.com/prometheus/prometheus/cmd/promtool
go get -u github.com/devopyio/yamlfmt
go get -u github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
setup_all: setup_jsonnet setup
fmt:
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | xargs -n 1 -- $(JSONNET_FMT) -i
prometheus_alerts.yaml: mixin.libsonnet lib/alerts.jsonnet alerts/*.libsonnet
jsonnet -J vendor -S lib/alerts.jsonnet > $@
check: prometheus_alerts.yaml
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
while read f; do \
$(JSONNET_FMT) "$$f" | diff -u "$$f" -; \
done
promtool check rules prometheus_alerts.yaml
clean:
rm -rf prometheus_alerts.yaml
yamlfmt: prometheus_alerts.yaml
yamlfmt -filename prometheus_alerts.yaml
test: prometheus_alerts.yaml
promtool test rules tests.yaml