Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions postgres-observ-lib/.lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Linter configuration for postgres-observ-lib
# This file can be used to configure jsonnet linting rules

33 changes: 33 additions & 0 deletions postgres-observ-lib/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.PHONY: build clean lint fmt test dashboards alerts vendor

JSONNET_FMT := jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s
JSONNET_LINT := jsonnet-lint -J vendor

all: build

build: vendor dashboards alerts

clean:
rm -rf dashboards_out/* prometheus_rules_out/*

vendor:
jb install

dashboards: vendor
@mkdir -p dashboards_out
jsonnet -J vendor -m dashboards_out -e '(import "mixin.libsonnet").grafanaDashboards'

alerts: vendor
@mkdir -p prometheus_rules_out
jsonnet -J vendor -S -e 'std.manifestYamlDoc((import "mixin.libsonnet").prometheusAlerts)' > prometheus_rules_out/prometheus_alerts.yaml

fmt:
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
xargs -n 1 -- $(JSONNET_FMT) -i

lint: vendor
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
xargs -n 1 -- $(JSONNET_LINT)

test: lint build
@echo "Tests passed!"
Loading
Loading