-
Notifications
You must be signed in to change notification settings - Fork 29
/
Makefile
189 lines (163 loc) · 3.89 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
OUT_DIR = _output/bin
export GOFLAGS
# all make sub options
default: help
help:
@echo "Usage: make <target>"
@echo
@echo " 'build' - Build all knitter related binaries(e.g. knitter-manager,knitter-agent,knitter-plugin,knitter-mornitor)"
@echo " 'test-ut' - Test knitter with unit test"
@echo " 'test-e2e' - Test knitter with e2e test"
@echo " 'clean' - Clean all output artifacts"
@echo " 'verify' - Execute the source code verification tools(e.g. gofmt,lint,govet)"
@echo " 'install-extra' - Install tools used by verify(e.g. gometalinter)"
# Ideally not needed this section
check-gopath:
ifndef GOPATH
$(error GOPATH is not set)
endif
.PHONY: check-gopath
# Build code.
#
# Args:
# GOFLAGS: Extra flags to pass to 'go' when building.
#
# Example:
# make build
# make all
all build: knitter-manager knitter-agent knitter-plugin knitter-monitor
.PHONY: all build
# Build knitter-plugin
#
# Example:
# make knitter-plugin
knitter-plugin:
hack/build/plugin.sh build
mkdir -p ${OUT_DIR}
mv ./knitter-plugin/knitter-plugin ${OUT_DIR}
.PHONY: knitter-plugin
# Build knitter-manager
#
# Example:
# make knitter-manager
knitter-manager:
hack/build/manager.sh build
mkdir -p ${OUT_DIR}
mv ./knitter-manager/knitter-manager ${OUT_DIR}
.PHONY: knitter-manager
# Build knitter-monitor
#
# Example:
# make knitter-monitor
knitter-monitor:
hack/build/monitor.sh build
mkdir -p ${OUT_DIR}
mv ./knitter-monitor/knitter-monitor ${OUT_DIR}
.PHONY: knitter-monitor
# Build knitter-agent
#
# Example:
# make knitter-agent
knitter-agent:
hack/build/agent.sh build
mkdir -p ${OUT_DIR}
mv ./knitter-agent/knitter-agent ${OUT_DIR}
.PHONY: knitter-agent
# Lint knitter code files. note that this lint process handled by gometalinter tools.
# link here (github.com/alecthomas/gometalinter)
# If users only need simple lint process, please run command 'make golint'.
# Example:
# make lint
lint: check-gopath
@echo "checking lint"
hack/verify-lint.sh
# Lint knitter code files with golint tool.
#
# Example:
# make golint
golint: check-gopath
@echo "checking golint"
hack/verify-golint.sh
# Format knitter code files with gofmt tool.
#
# Example:
# make gofmt
gofmt:
@echo "checking gofmt"
hack/verify-gofmt.sh
# Static check knitter code files
#
# Example:
# make govet
govet:
@echo "checking govet"
hack/verify-govet.sh
# Verify whether code is properly organized.
#
# Example:
# make verify
verify: gofmt govet
.PHONY: verify
# strict-verify do more strict verify process
#
# Example:
# make strict-verify
strict-verify:gofmt lint govet
.PHONY:strict-verify
# Run verify and test process
#
# Example
# make verify
check: verify test-ut
.PHONY: check
# Run unit tests
#
# Example:
# make test-ut
test-ut:
go test -timeout=20m -race ./pkg/... ./knitter-agent/... ./knitter-manager/... ./knitter-monitor/... ./knitter-plugin/... $(BUILD_TAGS) $(GO_LDFLAGS) $(GO_GCFLAGS)
.PHONY: test-ut
# Run coverage checking
#
# Example:
#make test-cover
test-cover:
PATH="$HOME/gopath/bin:$PATH"
./hack/cover.sh --coveralls
.PHTONY: test-cover
install-extra:install-gometalinter
.PHONY: install-extra
# install gometailinter tool
#
# Example:
# make install-gometalinter
install-gometalinter:
go get -u github.com/alecthomas/gometalinter
gometalinter --install
.PHONY: install-gometalinter
# Deploy a dind kubernetes cluser
# note: Leverage Mirantis kubeadm-dind-cluster
# Example:
# make deploy-k8s
deploy-k8s:
./hack/dind-cluster-v1.8.sh up
.PHONY: deploy-k8s
# Run knitter e2e test case
# Example:
# make test-e2e
# NOTE THAT: knitter test-e2e is experimental now.
test-e2e:
./hack/run-robotframe-e2e.sh
.PHONY: test-e2e
# Just for test
probe-test:
./hack/probe-test.sh
.PHONY: probe-test
# Remove all build artifacts.
#
# Example:
# make clean
clean:
rm -rf ./_output
rm -rf .cover
.PHONY: clean