-
Notifications
You must be signed in to change notification settings - Fork 480
/
Makefile
62 lines (49 loc) · 1.75 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
CHARTSNAP_VERSION ?= v0.3.1
.PHONY: _download_tool
_download_tool:
(cd third_party && go mod tidy && \
GOBIN=$(PROJECT_DIR)/bin go generate -tags=third_party ./$(TOOL).go )
.PHONY: tools
tools: kube-linter chartsnap
KUBE_LINTER = $(PROJECT_DIR)/bin/kube-linter
.PHONY: kube-linter
kube-linter:
@$(MAKE) _download_tool TOOL=kube-linter
.PHONY: chartsnap
chartsnap:
./scripts/install-chartsnap.sh
.PHONY: lint
lint: tools lint.charts.kong lint.shellcheck
.PHONY: lint.charts.kong
lint.charts.kong:
$(KUBE_LINTER) lint charts/kong
lint.shellcheck:
shellcheck ./scripts/*
.PHONY: test.golden
test.golden:
@ $(MAKE) _chartsnap.kong && $(MAKE) _chartsnap.ingress || \
(echo "$$GOLDEN_TEST_FAILURE_MSG" && exit 1)
.PHONY: test.golden.update
test.golden.update:
@ $(MAKE) _chartsnap.kong CHARTSNAP_ARGS="-u"
@ $(MAKE) _chartsnap.ingress CHARTSNAP_ARGS="-u"
# Defining multi-line strings to echo: https://stackoverflow.com/a/649462/7958339
define GOLDEN_TEST_FAILURE_MSG
>> Golden tests have failed.
>> Please run 'make test.golden.update' to update golden files and commit the changes if they're expected.
endef
export GOLDEN_TEST_FAILURE_MSG
.PHONY: _chartsnap.kong
_chartsnap.kong:
@ $(MAKE) _chartsnap GOLDEN_TEST_CHART=kong GOLDEN_TEST_CHART_VALUES_DIR=./charts/kong/ci/ \
CHARTSNAP_ARGS=$(CHARTSNAP_ARGS)
.PHONY: _chartsnap.ingress
_chartsnap.ingress:
@ $(MAKE) _chartsnap GOLDEN_TEST_CHART=ingress GOLDEN_TEST_CHART_VALUES_DIR=./charts/ingress/ci/ \
CHARTSNAP_ARGS=$(CHARTSNAP_ARGS)
.PHONY: _chartsnap
_chartsnap: chartsnap
@ helm repo update
@ helm dependencies update charts/ingress
@ helm chartsnap -c ./charts/$(GOLDEN_TEST_CHART) -f $(GOLDEN_TEST_CHART_VALUES_DIR) $(CHARTSNAP_ARGS)