зеркало из https://github.com/github/vitess-gh.git
45 строки
1.4 KiB
Makefile
45 строки
1.4 KiB
Makefile
.PHONY: dashboards_out
|
|
|
|
JSONNET_ARGS := -n 2 --max-blank-lines 2 --string-style s --comment-style s
|
|
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)
|
|
|
|
all: fmt prometheus_alerts.yaml prometheus_rules.yaml dashboards_out lint test
|
|
|
|
fmt:
|
|
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
|
|
xargs -n 1 -- $(JSONNET_FMT) -i
|
|
|
|
jsonnet_bundle_install:
|
|
jb install
|
|
|
|
prometheus_alerts.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 > $@
|
|
|
|
dashboards_out: mixin.libsonnet lib/dashboards.jsonnet dashboards/*.libsonnet
|
|
@mkdir -p dashboards_out
|
|
jsonnet -J vendor -m dashboards_out lib/dashboards.jsonnet
|
|
|
|
lint: prometheus_alerts.yaml prometheus_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_rules.yaml
|
|
promtool check rules prometheus_alerts.yaml
|
|
|
|
clean:
|
|
rm -rf dashboards_out prometheus_alerts.yaml prometheus_rules.yaml
|
|
|
|
test: prometheus_alerts.yaml prometheus_rules.yaml
|
|
promtool test rules tests.yaml
|