forked from helm/chartmuseum
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
126 lines (102 loc) · 3.61 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Change this and commit to create new release
VERSION=1.0.0
REVISION := $(shell git rev-parse --short HEAD;)
# MOD_PROXY_URL ?= "https://gocenter.io"
CM_LOADTESTING_HOST ?= http://localhost:8080
.PHONY: bootstrap
bootstrap: export GO111MODULE=on
bootstrap: export GOPROXY=$(MOD_PROXY_URL)
bootstrap:
@go mod download
.PHONY: build
build: build-linux build-mac build-windows
build-windows: export GOOS=windows
build-windows: export GOARCH=amd64
build-windows: export GO111MODULE=on
build-windows: export GOPROXY=$(MOD_PROXY_URL)
build-windows:
go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
-o bin/windows/amd64/chart-registry cmd/chart-registry/main.go # windows
sha256sum bin/windows/amd64/chart-registry || shasum -a 256 bin/windows/amd64/chart-registry
build-linux: export GOOS=linux
build-linux: export GOARCH=amd64
build-linux: export CGO_ENABLED=0
build-linux: export GO111MODULE=on
build-linux: export GOPROXY=$(MOD_PROXY_URL)
build-linux:
go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
-o bin/linux/amd64/chart-registry cmd/chart-registry/main.go # linux
sha256sum bin/linux/amd64/chart-registry || shasum -a 256 bin/linux/amd64/chart-registry
build-armv7: export GOOS=linux
build-armv7: export GOARCH=arm
build-armv7: export GOARM=7
build-armv7: export CGO_ENABLED=0
build-armv7: export GO111MODULE=on
build-armv7: export GOPROXY=$(MOD_PROXY_URL)
build-armv7:
go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
-o bin/linux/armv7/chart-registry cmd/chart-registry/main.go # linux
container-armv7: build-armv7
container-armv7:
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker build . -t chart-registry:v$(VERSION) -f Dockerfile.arm
build-mac: export GOOS=darwin
build-mac: export GOARCH=amd64
build-mac: export CGO_ENABLED=0
build-mac: export GO111MODULE=on
build-mac: export GOPROXY=$(MOD_PROXY_URL)
build-mac:
go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
-o bin/darwin/amd64/chart-registry cmd/chart-registry/main.go # mac osx
sha256sum bin/darwin/amd64/chart-registry || shasum -a 256 bin/darwin/amd64/chart-registry
.PHONY: clean
clean:
@git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf
.PHONY: setup-test-environment
setup-test-environment:
@./scripts/setup_test_environment.sh
.PHONY: test
test: export CGO_ENABLED=0
test: export GO111MODULE=on
test: export GOPROXY=$(MOD_PROXY_URL)
test: setup-test-environment
@./scripts/test.sh
.PHONY: startloadtest
startloadtest:
@cd loadtesting && pipenv install
@cd loadtesting && pipenv run locust --host $(CM_LOADTESTING_HOST)
.PHONY: covhtml
covhtml:
@go tool cover -html=.cover/cover.out
.PHONY: acceptance
acceptance: setup-test-environment
@./scripts/acceptance.sh
.PHONY: run
run:
@rm -rf .chartstorage/
@bin/darwin/amd64/chart-registry --debug --port=8080 --storage="local" \
--storage-local-rootdir=".chartstorage/"
.PHONY: tree
tree:
@tree -I vendor
# https://github.com/hirokidaichi/goviz/pull/8
.PHONY: goviz
goviz:
#@go get -u github.com/RobotsAndPencils/goviz
@goviz -i helm.sh/chart-registry/cmd/chart-registry -l | dot -Tpng -o goviz.png
.PHONY: release-latest
release-latest:
@scripts/release.sh latest
.PHONY: release-stable
release-stable:
@scripts/release.sh $(VERSION)
.PHONY: version-released
version-released:
@scripts/version_released.sh $(VERSION)
.PHONY: get-version
get-version:
@echo $(VERSION)
.PHONY: get-version
image: build-linux
@docker build -t index.alauda.cn/claas/chart-registry .
@docker push index.alauda.cn/claas/chart-registry