-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
35 lines (25 loc) · 1.03 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
VERSION := 0
RELEASE := 1
JSONNET_FMT := jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s
all: fmt prometheus_alert_rules.yaml lint test generate_cr
fmt:
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
xargs -n 1 -- $(JSONNET_FMT) -i
prometheus_alert_rules.yaml: mixin.libsonnet lib/alerts.jsonnet alerts/*.libsonnet
jsonnet -S lib/alerts.jsonnet > $@
prometheus_rules.yaml: mixin.libsonnet lib/rules.jsonnet rules/*.libsonnet
jsonnet -S lib/rules.jsonnet > $@
lint: prometheus_alert_rules.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_alert_rules.yaml
clean:
rm -rf prometheus_alert_rules.yaml
rm -rf prometheus_rules.yaml
test: prometheus_alert_rules.yaml prometheus_rules.yaml
promtool test rules tests/test_alerts.yaml
promtool test rules tests/test_rules.yaml
generate_cr:
cd extras/;jb install;./build.sh