-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (54 loc) · 2.33 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
65
66
67
68
69
70
71
72
73
74
75
#Makefile for Helm Operations
REPO ?= unstructured-api
GIT_TAG = $(shell git describe --tags $(git rev-list --tags --max-count=1) | sed s/v//g)
VERSION ?= $(shell cat ${REPO}/Chart.yaml | grep "version:" | awk -F': ' '{print $$2}')
NEXT_VERSION ?= $(shell echo ${VERSION} | awk -F. -v OFS=. '{$$NF += 1 ; print}')
package: ## Packages the helm chart
helm package charts/${REPO} --destination charts/
.PHONY: package
index: ## Packages the helm chart
Helm repo index --url https://kkacsh321.github.io/unstructured-api-helm-chart .
.PHONY: package
push: ## Pushes helm chart to ECR
helm push ${REPO}-${VERSION}.tgz oci://${REGISTRY}/
.PHONY: push
template: ## Runs helm template with default values
helm template charts/${REPO}
.PHONY: template
template-test: ## Runs helm template with default values
helm template charts/${REPO} -f test-values.yaml
.PHONY: template
lint: ## Runs helm lint
helm lint charts/${REPO}
.PHONY: lint
ct: ## Runs helm chart-testing
ct lint charts/${REPO}
.PHONY: lint
check-version: ## Checks for the required version bump
@echo "\033[36m"Checking Version"\033[0m"; \
if [ "${GIT_TAG}" == "${VERSION}" ]; then \
echo "\033[0;31mVersion is equal to current tag ${VERSION}, please update it!\033[0m"; \
else \
echo "\033[0;32mVersion is not equal to current tag ${VERSION}, good to go\033[0m"; \
fi
@echo "\033[36m"Version Check Complete"\033[0m"
.PHONY: check-version
bump-version: ## bump minor version
@echo "Current version in repo is \033[0;31m${VERSION}\033[0m"; \
echo "New version will be \033[0;32m${NEXT_VERSION}\033[0m"; \
sed 's/'${VERSION}'/'${NEXT_VERSION}'/g' ./charts/${REPO}/Chart.yaml > Chart.tmp; \
rm ./cahrts/${REPO}/Chart.yaml; \
mv Chart.tmp ./charts/${REPO}/Chart.yaml; \
echo "Version now set to \033[36m${NEXT_VERSION}\033[0m"
.PHONY: bump-version
version: ## Prints Current Version
@echo "Current version in repo is \033[0;31m${VERSION}\033[0m"
.PHONY: version
prepare-pr: lint ct check-version package index ## Runs helm lint, and version check for before your PR
@echo "\033[36m"Done Running PR Checks"\033[0m"
.PHONY: prepare-pr
help: ## show this usage
@echo "\033[36mHelm Makefile:\033[0m\nUsage: make [command]\n"; \
grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: help
.DEFAULT_GOAL := help