-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
87 lines (67 loc) · 2.42 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
76
77
78
79
80
81
82
83
84
85
86
87
.PHONY: release
ifeq (${BRANCH},)
BRANCH = $$(git rev-parse --abbrev-ref HEAD)
endif
VERSION = $$(git rev-parse HEAD)
SHORT_VERSION = $$(git rev-parse --short=7 HEAD)
RED='\033[1;31m'
CYAN='\033[1;36m'
NO_COLOR='\033[0m'
CURRENT_VERSION := $(shell cat version)
NEXT_PATCH := $(shell docker-compose run --rm toolbox bash -c 'CURRENT_VERSION=$(CURRENT_VERSION) && semver bump patch $$CURRENT_VERSION')
NEXT_MINOR := $(shell docker-compose run --rm toolbox bash -c 'CURRENT_VERSION=$(CURRENT_VERSION) && semver bump minor $$CURRENT_VERSION')
NEXT_MAJOR := $(shell docker-compose run --rm toolbox bash -c 'CURRENT_VERSION=$(CURRENT_VERSION) && semver bump major $$CURRENT_VERSION')
# Development targets
clean_world: destroy_shell build_shell up
destroy_shell:
docker compose down -v
build_shell:
docker compose build
up:
docker compose up
shell:
docker compose run --service-ports --rm controller bash
lint:
golangci-lint run
fix_lint:
golangci-lint run --fix
test:
ENV=test go test ./...
generate_docs:
cmd/swag init -g cmd/controller/main.go --generatedTime=false --markdownFiles docs/markdown
setup_gke_kube:
gcloud auth activate-service-account --key-file ${SERVICE_ACCOUNT_KEY}
gcloud config set project ${GCP_PROJECT_ID}
gcloud container clusters get-credentials ${CLUSTER_NAME} --region ${GCP_REGION}
update_gke_controller_service:
kubectl set image deployment/uffizzi-controller -n uffizzi controller=${CONTROLLER_IMAGE}
get_token:
gcloud config config-helper --format="value(credential.access_token)"
version:
echo ${CURRENT_VERSION}
release_patch: export NEW_VERSION=${NEXT_PATCH}
release_patch:
make release
release_minor: export NEW_VERSION=${NEXT_MINOR}
release_minor:
make release
release_major: export NEW_VERSION=${NEXT_MAJOR}
release_major:
make release
release:
git checkout develop
@echo "Bumping version from $(CURRENT_VERSION) to $(NEW_VERSION)"
echo $(NEW_VERSION) > 'version'
@echo 'Set a new chart version'
sed 's/^\(version: \).*$$/\1$(NEW_VERSION)/' ./charts/uffizzi-controller/Chart.yaml > temp.yaml && mv temp.yaml ./charts/uffizzi-controller/Chart.yaml
git commit -am "Change version to $(NEW_VERSION)"
git push origin develop
git checkout main
@echo 'Update remote origin'
git remote update
git pull origin --rebase main
git merge --no-ff --no-edit origin/develop
git push origin main
@echo 'Create a new tag'
git tag uffizzi-controller-${NEW_VERSION}
git push origin uffizzi-controller-${NEW_VERSION}