-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (69 loc) · 2.45 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
KUBECONFIG=$(HOME)/.kube/dev
tag=dev
version=v1
image=paskalmaksim/helm-blue-green:$(tag)
hash=$(shell git rev-parse --short HEAD)
beta=beta-$(hash)
lint:
helm dep up test/deploy --skip-refresh
ct lint --all
ct lint --charts test/deploy
ct lint --charts e2e/chart
helm template ./charts/helm-blue-green | kubectl apply --dry-run=server -f -
build:
git tag -d `git tag -l "helm-blue-green-*"`
git tag -d `git tag -l "helm-chart-*"`
go run github.com/goreleaser/goreleaser/v2@latest build --clean --snapshot --skip=validate
mv ./dist/helm-blue-green_linux_amd64_v1/helm-blue-green ./helm-blue-green
docker buildx build --platform=linux/amd64 --pull --push . -t $(image)
promote-to-beta:
git tag -d `git tag -l "helm-blue-green-*"`
git tag -d `git tag -l "helm-chart-*"`
go run github.com/goreleaser/goreleaser/v2@latest release --clean --snapshot
# rename helm-blue-green to beta + hash
docker tag paskalmaksim/helm-blue-green:beta-arm64 paskalmaksim/helm-blue-green:$(beta)-arm64
docker tag paskalmaksim/helm-blue-green:beta-amd64 paskalmaksim/helm-blue-green:$(beta)-amd64
# push beta + hash
docker push paskalmaksim/helm-blue-green:$(beta)-arm64
docker push paskalmaksim/helm-blue-green:$(beta)-amd64
docker manifest create --amend paskalmaksim/helm-blue-green:$(beta) \
paskalmaksim/helm-blue-green:$(beta)-arm64 \
paskalmaksim/helm-blue-green:$(beta)-amd64
docker manifest push --purge paskalmaksim/helm-blue-green:$(beta)
clean:
helm --namespace helm-blue-green delete helm-blue-green || true
kubectl delete ns helm-blue-green || true
install:
rm -rf test/deploy/charts
helm dep up test/deploy --skip-refresh
helm upgrade --install helm-blue-green \
--namespace helm-blue-green \
--create-namespace \
--set helm-blue-green.image.tag=$(tag) \
--set helm-blue-green.image.pullPolicy=Always \
--set helm-blue-green.version=$(version) \
test/deploy
.PHONY: e2e
e2e:
make clean
helm upgrade --install helm-blue-green \
--namespace helm-blue-green \
--create-namespace \
e2e/chart
NAMESPACE=helm-blue-green go test -v ./e2e \
--kubeconfig $(KUBECONFIG)
make clean
.PHONY: test
test:
./scripts/validate-license.sh
go fmt ./cmd/... ./pkg/... ./internal/...
go vet ./cmd/... ./pkg/... ./internal/...
go test ./pkg/...
go mod tidy
go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run -v
run:
NAMESPACE=default go run --race ./cmd \
--config=./e2e/testdata/test2.yaml \
--log.level=debug \
--log.json=false \
--kubeconfig $(KUBECONFIG)