-
Notifications
You must be signed in to change notification settings - Fork 177
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (79 loc) · 3.74 KB
/
Makefile
File metadata and controls
104 lines (79 loc) · 3.74 KB
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
.PHONY: all build builder clean compress dev generate mocks release release-cli release-image release-provider release-version version-gen test test-docker
commands = build monitor rack
injects = convox-env
assets = $(wildcard assets/*)
binaries = $(addprefix $(GOPATH)/bin/, $(commands))
sources = $(shell find . -name '*.go')
statics = $(addprefix $(GOPATH)/bin/, $(injects))
DEV ?= true
ifeq ($(DEV), false)
VERSION := $(shell date +%Y%m%d%H%M%S)
else ifndef VERSION
VERSION := $(shell date +%Y%m%d%H%M%S)-dev
endif
all: build
build: $(binaries) $(statics)
builder:
docker buildx build --platform linux/amd64 -t convox/build:$(VERSION) --no-cache --pull --push -f cmd/build/Dockerfile .
docker buildx build --platform linux/arm64 -t convox/build:$(VERSION)-arm64 --no-cache --pull --push -f cmd/build/Dockerfile.arm .
clean:
make -C cmd/convox clean
compress: $(binaries) $(statics)
upx-ucl -1 $^
dev:
test -n "$(RACK)" # RACK
docker build --target development -t convox/rack:dev .
ifdef UPLOAD
docker push convox/rack:dev
kubectl patch deployment/api -p '{"spec":{"template":{"spec":{"containers":[{"name":"main","imagePullPolicy":"Always"}]}}}}' -n $(RACK)
kubectl patch deployment/router -p '{"spec":{"template":{"spec":{"containers":[{"name":"main","imagePullPolicy":"Always"}]}}}}' -n convox-system
endif
convox rack update dev --wait
kubectl delete pod --all -n convox-system
kubectl delete pod --all -n $(RACK)
kubectl rollout status deployment/api -n $(RACK)
kubectl rollout status deployment/router -n convox-system
convox rack logs
generate:
go run cmd/generate/main.go controllers > pkg/api/controllers.go
go run cmd/generate/main.go routes > pkg/api/routes.go
go run cmd/generate/main.go sdk > sdk/methods.go
generate-provider:
go run cmd/generate/main.go controllers > pkg/api/controllers.go
go run cmd/generate/main.go routes > pkg/api/routes.go
go run cmd/generate/main.go sdk > sdk/methods.go
mocks: generate-provider
go get -u github.com/vektra/mockery/.../
make -C pkg/structs mocks
mockery -case underscore -dir pkg/start -outpkg sdk -output pkg/mock/start -name Interface
mockery -case underscore -dir sdk -outpkg sdk -output pkg/mock/sdk -name Interface
mockery -case underscore -dir vendor/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface -outpkg aws -output pkg/mock/aws -name CloudWatchAPI
mockery -case underscore -dir vendor/github.com/convox/stdcli -outpkg stdcli -output pkg/mock/stdcli -name Executor
regions:
@aws-vault exec convox-release-standard go run provider/aws/cmd/regions/main.go
@aws-vault exec convox-release-govcloud go run provider/aws/cmd/regions/main.go
release:
test -n "$(VERSION)" # VERSION
git tag $(VERSION) -m $(VERSION)
git push origin refs/tags/$(VERSION)
release-all: release-version release-cli release-image builder release-provider
release-cli: release-version
make -C cmd/convox release VERSION=$(VERSION)
release-image: release-version
docker buildx build --platform linux/amd64 -t convox/rack:$(VERSION) --no-cache --pull --push .
docker buildx build --platform linux/arm64 -t convox/rack:$(VERSION)-arm64 --no-cache --pull --push -f Dockerfile.arm .
release-provider: release-version
make -C provider release VERSION=$(VERSION)
release-version:
test -n "$(VERSION)" # VERSION
version-gen:
@echo $(shell date +%Y%m%d%H%M%S)
test:
env PROVIDER=test go test -covermode atomic -coverprofile coverage.txt ./...
test-docker:
docker build -t convox/rack:test --target development .
docker run -it convox/rack:test make test
$(binaries): $(GOPATH)/bin/%: $(sources)
env CGO_ENABLED=0 GOOS=linux go build -mod=vendor -tags=hidraw -ldflags="-extldflags=-static" -o $@ ./cmd/$*
$(statics): $(GOPATH)/bin/%: $(sources)
env CGO_ENABLED=0 go install --ldflags '-extldflags "-static" -s -w' ./cmd/$*