mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-09 23:24:09 -08:00
Add Makefile to easily make output files and lint sources
Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
parent
f17829c48b
commit
f2891703a5
7
docs/node-mixin/.gitignore
vendored
7
docs/node-mixin/.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
/jsonnetfile.lock.json
|
||||
/vendor/
|
||||
|
||||
jsonnetfile.lock.json
|
||||
vendor
|
||||
*.yaml
|
||||
dashboards_out
|
||||
|
|
28
docs/node-mixin/Makefile
Normal file
28
docs/node-mixin/Makefile
Normal file
|
@ -0,0 +1,28 @@
|
|||
JSONNET_FMT := jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s
|
||||
|
||||
all: fmt node_alerts.yaml node_rules.yaml dashboards_out lint
|
||||
|
||||
fmt:
|
||||
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
|
||||
xargs -n 1 -- $(JSONNET_FMT) -i
|
||||
|
||||
node_alerts.yaml: mixin.libsonnet config.libsonnet $(wildcard alerts/*)
|
||||
jsonnet -S alerts.jsonnet > $@
|
||||
|
||||
node_rules.yaml: mixin.libsonnet config.libsonnet $(wildcard rules/*)
|
||||
jsonnet -S rules.jsonnet > $@
|
||||
|
||||
dashboards_out: mixin.libsonnet config.libsonnet $(wildcard dashboards/*)
|
||||
@mkdir -p dashboards_out
|
||||
jsonnet -J vendor -m dashboards_out dashboards.jsonnet
|
||||
|
||||
lint: node_alerts.yaml node_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 node_alerts.yaml node_rules.yaml
|
||||
|
||||
clean:
|
||||
rm -rf dashboards_out node_alerts.yaml node_rules.yaml
|
Loading…
Reference in a new issue