diff --git a/Makefile b/Makefile index 4f13f27..45ecf77 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ JSONNET_FMT := jsonnet fmt -n 2 --max-blank-lines 2 --string-style s --comment-style s -JB_BINARY:=$(GOPATH)/bin/jb +JSONNET_BIN := $(GOPATH)/bin/jsonnet +JB_BINARY := $(GOPATH)/bin/jb .PHONY: generate vendor fmt manifests @@ -8,7 +9,7 @@ all: manifests manifests: jsonnet rm -rf manifests - ./scripts/build.sh main.jsonnet + ./scripts/build.sh main.jsonnet $(JSONNET_BIN) update: jb update diff --git a/manifests/alertmanager-secret.yaml b/manifests/alertmanager-secret.yaml index 79fc7a2..9be86af 100644 --- a/manifests/alertmanager-secret.yaml +++ b/manifests/alertmanager-secret.yaml @@ -1,6 +1,6 @@ apiVersion: v1 data: - alertmanager.yaml: Imdsb2JhbCI6IAogICJyZXNvbHZlX3RpbWVvdXQiOiAiNW0iCiJyZWNlaXZlcnMiOiAKLSAibmFtZSI6ICJudWxsIgoicm91dGUiOiAKICAiZ3JvdXBfYnkiOiAKICAtICJqb2IiCiAgImdyb3VwX2ludGVydmFsIjogIjVtIgogICJncm91cF93YWl0IjogIjMwcyIKICAicmVjZWl2ZXIiOiAibnVsbCIKICAicmVwZWF0X2ludGVydmFsIjogIjEyaCIKICAicm91dGVzIjogCiAgLSAibWF0Y2giOiAKICAgICAgImFsZXJ0bmFtZSI6ICJEZWFkTWFuc1N3aXRjaCIKICAgICJyZWNlaXZlciI6ICJudWxsIg== + alertmanager.yaml: Imdsb2JhbCI6CiAgInJlc29sdmVfdGltZW91dCI6ICI1bSIKInJlY2VpdmVycyI6Ci0gIm5hbWUiOiAibnVsbCIKInJvdXRlIjoKICAiZ3JvdXBfYnkiOgogIC0gImpvYiIKICAiZ3JvdXBfaW50ZXJ2YWwiOiAiNW0iCiAgImdyb3VwX3dhaXQiOiAiMzBzIgogICJyZWNlaXZlciI6ICJudWxsIgogICJyZXBlYXRfaW50ZXJ2YWwiOiAiMTJoIgogICJyb3V0ZXMiOgogIC0gIm1hdGNoIjoKICAgICAgImFsZXJ0bmFtZSI6ICJEZWFkTWFuc1N3aXRjaCIKICAgICJyZWNlaXZlciI6ICJudWxsIg== kind: Secret metadata: name: alertmanager-main diff --git a/scripts/build.sh b/scripts/build.sh index f68cd44..708323b 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,5 +1,13 @@ #!/usr/bin/env bash +if ! [ -x "$(command -v $2)" ]; then + JSONNET_BIN=jsonnet + echo "using jsonnet from path" +else + JSONNET_BIN=$2 + echo "using jsonnet from arg" +fi + # This script uses arg $1 (name of *.jsonnet file to use) to generate the manifests/*.yaml files. set -e @@ -11,6 +19,6 @@ set -o pipefail rm -rf manifests mkdir manifests - # optional, but we would like to generate yaml, not json -jsonnet -J vendor -m manifests "${1-example.jsonnet}" | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml; rm -f {}' -- {} +# optional, but we would like to generate yaml, not json +$JSONNET_BIN -J vendor -m manifests "${1-example.jsonnet}" | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml; rm -f {}' -- {}