Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit cbe9eaf

Browse files
committed
Add phony test-readme target to test that the README.md setup instructions work
Signed-off-by: Jack Baldry <[email protected]>
1 parent 80ca611 commit cbe9eaf

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

Makefile

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
.PHONY: lint build-image publish-build-image
1+
.PHONY: lint build-image publish-build-image test-readme
22

33
JSONNET_FMT := jsonnetfmt
44

55
lint:
6-
@RESULT=0;
7-
for f in $$(find . -name '*.libsonnet' -print -o -name '*.jsonnet' -print); do
8-
$(JSONNET_FMT) -- "$$f" | diff -u "$$f" -;
9-
RESULT=$$(($$RESULT + $$?));
10-
done;
6+
@RESULT=0; \
7+
for f in $$(find . -name '*.libsonnet' -print -o -name '*.jsonnet' -print); do \
8+
$(JSONNET_FMT) -- "$$f" | diff -u "$$f" -; \
9+
RESULT=$$(($$RESULT + $$?)); \
10+
done; \
1111
exit $$RESULT
1212

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

1717
build-image:
@@ -21,24 +21,20 @@ publish-build-image:
2121
docker push grafana/cortex-jsonnet-build-image:$(shell git rev-parse --short HEAD)
2222

2323
build-mixin:
24-
cd cortex-mixin
25-
rm -rf out && mkdir out
26-
jb install
27-
jsonnet -J vendor -S dashboards.jsonnet -m out/
28-
jsonnet -J vendor -S recording_rules.jsonnet > out/rules.yaml
24+
cd cortex-mixin && \
25+
rm -rf out && mkdir out && \
26+
jb install && \
27+
jsonnet -J vendor -S dashboards.jsonnet -m out/ && \
28+
jsonnet -J vendor -S recording_rules.jsonnet > out/rules.yaml && \
2929
jsonnet -J vendor -S alerts.jsonnet > out/alerts.yaml
3030
zip -r cortex-mixin.zip cortex-mixin/out
31+
3132
test-readme:
32-
rm -rf -- test-readme
33-
GO111MODULE=on go get github.com/grafana/tanka/cmd/tk
34-
GO111MODULE=on go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
35-
mkdir test-readme && cd test-readme
36-
tk init --k8s=false
37-
jb install github.com/jsonnet-libs/k8s-alpha/1.18
38-
cat <<EOF > lib/k.libsonnet
39-
(import "github.com/jsonnet-libs/k8s-alpha/1.18/main.libsonnet") +
40-
(import "github.com/jsonnet-libs/k8s-alpha/1.18/extensions/kausal-shim.libsonnet")
41-
EOF
42-
jb install github.com/grafana/cortex-jsonnet/cortex
43-
cp vendor/cortex/cortex-manifests.jsonnet.example environments/default/main.jsonnet
44-
tk show environments/default
33+
rm -rf test-readme && \
34+
mkdir test-readme && cd test-readme && \
35+
tk init --k8s=false && \
36+
jb install github.com/jsonnet-libs/k8s-alpha/1.18 && \
37+
printf '(import "github.com/jsonnet-libs/k8s-alpha/1.18/main.libsonnet")\n+(import "github.com/jsonnet-libs/k8s-alpha/1.18/extensions/kausal-shim.libsonnet")' > lib/k.libsonnet && \
38+
jb install github.com/grafana/cortex-jsonnet/cortex && \
39+
cp vendor/cortex/cortex-manifests.jsonnet.example environments/default/main.jsonnet && \
40+
PAGER=cat tk show environments/default

0 commit comments

Comments
 (0)