forked from cloud-bulldozer/performance-dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (33 loc) · 1.3 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
JSONNET = https://github.com/google/jsonnet/releases/download/v0.15.0/jsonnet-bin-v0.15.0-linux.tar.gz
BINDIR = bin
TEMPLATESDIR = templates
OUTPUTDIR = rendered
ALLDIRS = $(BINDIR) $(OUTPUTDIR)
SYNCER_IMG_TAG = quay.io/cloud-bulldozer/dittybopper-syncer:latest
# Get all templates at $(TEMPLATESDIR)
TEMPLATES = $(wildcard $(TEMPLATESDIR)/*.jsonnet)
# Replace $(TEMPLATESDIR)/*.jsonnet by $(OUTPUTDIR)/*.json
outputs = $(patsubst $(TEMPLATESDIR)/%.jsonnet, $(OUTPUTDIR)/%.json, $(TEMPLATES))
all: deps format build
deps: $(ALLDIRS) $(TEMPLATESDIR)/grafonnet-lib $(BINDIR)/jsonnet
$(ALLDIRS):
mkdir -p $(ALLDIRS)
format: deps
$(BINDIR)/jsonnetfmt -i $(TEMPLATES)
build: deps $(TEMPLATESDIR)/grafonnet-lib $(outputs)
clean:
@echo "Cleaning up"
rm -rf $(ALLDIRS) $(TEMPLATESDIR)/grafonnet-lib
$(TEMPLATESDIR)/grafonnet-lib:
git clone --depth 1 https://github.com/grafana/grafonnet-lib.git $(TEMPLATESDIR)/grafonnet-lib
$(BINDIR)/jsonnet:
@echo "Downloading jsonnet binary"
curl -s -L $(JSONNET) | tar xz -C $(BINDIR)
# Build each template and output to $(OUTPUTDIR)
$(OUTPUTDIR)/%.json: $(TEMPLATESDIR)/%.jsonnet
@echo "Building template $<"
$(BINDIR)/jsonnet $< > $@
build-syncer-image:
podman build -f dittybopper/syncer/Dockerfile -t=${SYNCER_IMG_TAG} .
push-syncer-image:
podman push ${SYNCER_IMG_TAG}