-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
64 lines (51 loc) · 1.93 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
63
64
NAME := tekton-dashboard
CHART_DIR := charts/${NAME}
CHART_VERSION ?= latest
CHART_REPO := gs://jenkinsxio/charts
fetch:
rm -f ${CHART_DIR}/templates/*.yaml
mkdir -p ${CHART_DIR}/templates
ifeq ($(CHART_VERSION),latest)
curl -sS https://storage.googleapis.com/tekton-releases/dashboard/latest/release.yaml > ${CHART_DIR}/templates/resource.yaml
else
curl -sS https://storage.googleapis.com/tekton-releases/dashboard/previous/v${CHART_VERSION}/release.yaml > ${CHART_DIR}/templates/resource.yaml
endif
jx gitops split -d ${CHART_DIR}/templates
jx gitops rename -d ${CHART_DIR}/templates
# kustomize the resources to include some helm template blocs
kustomize build ${CHART_DIR} | sed '/helmTemplateRemoveMe/d' > ${CHART_DIR}/templates/resource.yaml
# Remove namespace from metadata to force with helm install
find $(CHART_DIR)/templates -type f -name "*.yaml" -exec yq -i eval 'del(.metadata.namespace)' "{}" \;
# Amend subjects.namespace with release.namespace
find . -type f \( -name "*-crb.yaml" -o -name "*-rb.yaml" \) -exec yq -i '(.subjects[] | select(has("namespace"))).namespace = "{{ .Release.Namespace }}"' "{}" \;
jx gitops split -d ${CHART_DIR}/templates
jx gitops rename -d ${CHART_DIR}/templates
cp src/templates/* ${CHART_DIR}/templates
ifneq ($(CHART_VERSION),latest)
sed -i "s/^appVersion:.*/appVersion: ${CHART_VERSION}/" ${CHART_DIR}/Chart.yaml
endif
build:
rm -rf Chart.lock
#helm dependency build
helm lint ${NAME}
install: clean build
helm install . --name ${NAME}
upgrade: clean build
helm upgrade ${NAME} .
delete:
helm delete --purge ${NAME}
clean:
release: clean
sed -i -e "s/version:.*/version: $(VERSION)/" Chart.yaml
helm dependency build
helm lint
helm package .
helm repo add jx-labs $(CHART_REPO)
helm gcs push ${NAME}*.tgz jx-labs --public
rm -rf ${NAME}*.tgz%
test:
cd tests && go test -v
test-regen:
cd tests && export HELM_UNIT_REGENERATE_EXPECTED=true && go test -v
verify:
jx kube test run