-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
71 lines (50 loc) · 1.95 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
DOCKER_REGISTRY ?= jozuenoon
GIT_BRANCH := $(shell git branch | sed -n '/\* /s///p' 2>/dev/null)
GIT_COMMIT := $(shell git rev-parse HEAD 2>/dev/null)
# This docker build produce intermittent tags tied to branch and commit. Useful while developing and
# making deployments to test environment.
build_docker: cqserver_docker
cqserver_docker:
# eval $(minikube docker-env)
docker build -f cmd/cq/Dockerfile -t $(DOCKER_REGISTRY)/message_bus:$(GIT_BRANCH)_$(GIT_COMMIT) -t $(DOCKER_REGISTRY)/message_bus:latest .
test:
go test -race ./...
integration:
ETCD_ENDPOINTS=http://127.0.0.1:2379 go test -tags integration -race ./...
.PHONY: bin
bin:
go build -o bin/cqserver cmd/cq/main.go
go build -o bin/mbcli mbcli/main.go
install:
go build -o bin/mbcli mbcli/main.go
chmod +x bin/mbcli
cp bin/mbcli $$HOME/bin/mbcli
# Generators
gen: collector query
## Collector
collector: collector/collector.pb.go collector/mocks/repository.go
collector/collector.pb.go: proto/collector.proto
protoc -I proto/ $< --go_out=plugins=grpc:./collector
collector/mocks/repository.go: collector/repository.go
mockery -name=Repository -dir ./collector -output ./collector/mocks -case snake
## Query
query: query/query.pb.go query/mocks/repository.go
query/query.pb.go: proto/query.proto
protoc -I proto/ $< --go_out=plugins=grpc:./query
query/mocks/repository.go: query/repository.go
mockery -name=Repository -dir ./query -output ./query/mocks -case snake
deployment-check: deployment-cqserver-check
deployment-cqserver-check:
helm install deployment/cqserver/ --debug --dry-run
deploy-minikube:
helm upgrade message-bus \
--install \
--kube-context minikube \
--set ImageTag=$(GIT_BRANCH)_$(GIT_COMMIT) \
--set DockerRegistry=$(DOCKER_REGISTRY) \
--set ServiceType=NodePort
--namespace=tdc deployment/cqserver
deploy-etcd-operator:
helm upgrade etcd-operator --install stable/etcd-operator --namespace tdc
deploy-etcd:
kubectl apply -f deployment/etcd/etcd.yaml --namespace tdc