This repository was archived by the owner on Jun 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (54 loc) · 1.24 KB
/
Makefile
File metadata and controls
63 lines (54 loc) · 1.24 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
CHARTS_DIR := ./charts
SERVE_DIR := ./dist
# --no-print-directory avoids verbose cd logging when invoking targets that utilize sub-makes
MAKE_OPTS ?= --no-print-directory
ifeq ($(OS),Windows_NT)
SHELL ?= cmd.exe
CHECK ?= where.exe
else
SHELL ?= bash
CHECK ?= command -v
endif
HAS_HELM := $(shell $(CHECK) helm)
.PHONY: default
default:
ifndef HAS_HELM
$(error You must install helm)
endif
# all-charts loops through all charts and runs the make target(s) provided
define all-charts
@for chart in $$(ls -1 $(CHARTS_DIR)); do \
CHART=$$chart make $(MAKE_OPTS) $(1) || exit $$? ; \
done
endef
.PRECIOUS: build
.PHONY: build
build: clean
ifndef CHART
$(error CHART is undefined)
endif
ifndef VERSION
$(error VERSION is undefined)
endif
@helm dep up $(CHARTS_DIR)/$(CHART)
@mkdir -p $(SERVE_DIR)
@helm package --version $(VERSION) -d $(SERVE_DIR) $(CHARTS_DIR)/$(CHART)
.PHONY: test
test:
ifndef CHART
$(call all-charts,test)
else
@helm lint $(CHARTS_DIR)/$(CHART)
endif
.PHONY: index
index:
@mkdir -p $(SERVE_DIR)
@helm repo index --merge $(SERVE_DIR)/index.yaml $(SERVE_DIR)
# remove untracked sub-chart artifacts before rebuilding
.PHONY: clean
clean:
ifndef CHART
$(call all-charts,clean)
else
@rm -rf $(CHARTS_DIR)/$(CHART)/charts
endif