1
- .PHONY : lint build-image publish-build-image
1
+ .PHONY : lint build-image publish-build-image test-readme
2
2
3
3
JSONNET_FMT := jsonnetfmt
4
4
5
5
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 ; \
11
11
exit $$ RESULT
12
12
13
13
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 | \
15
15
xargs -n 1 -- $(JSONNET_FMT ) -i
16
16
17
17
build-image :
@@ -21,24 +21,20 @@ publish-build-image:
21
21
docker push grafana/cortex-jsonnet-build-image:$(shell git rev-parse --short HEAD)
22
22
23
23
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 && \
29
29
jsonnet -J vendor -S alerts.jsonnet > out/alerts.yaml
30
30
zip -r cortex-mixin.zip cortex-mixin/out
31
+
31
32
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