| 1 |
JSONNET_FMT := jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s |
| 2 |
|
| 3 |
all: fmt prometheus_alerts.yaml dashboards_out lint |
| 4 |
|
| 5 |
fmt: |
| 6 |
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \ |
| 7 |
xargs -n 1 -- $(JSONNET_FMT) -i |
| 8 |
|
| 9 |
prometheus_alerts.yaml: mixin.libsonnet config.libsonnet alerts.libsonnet |
| 10 |
jsonnet -S alerts.jsonnet > $@ |
| 11 |
|
| 12 |
dashboards_out: mixin.libsonnet config.libsonnet dashboards.libsonnet |
| 13 |
@mkdir -p dashboards_out |
| 14 |
jsonnet -J vendor -m dashboards_out dashboards.jsonnet |
| 15 |
|
| 16 |
lint: prometheus_alerts.yaml |
| 17 |
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \ |
| 18 |
while read f; do \ |
| 19 |
$(JSONNET_FMT) "$$f" | diff -u "$$f" -; \ |
| 20 |
done |
| 21 |
|
| 22 |
promtool check rules prometheus_alerts.yaml |
| 23 |
|
| 24 |
.PHONY: jb_install |
| 25 |
jb_install: |
| 26 |
jb install |
| 27 |
|
| 28 |
clean: |
| 29 |
rm -rf dashboards_out prometheus_alerts.yaml |