Debian Codegraph @

Makefile

raw
1 # run from repository root
2
3
4
5 # Example:
6 # make build
7 # make clean
8 # make docker-clean
9 # make docker-start
10 # make docker-kill
11 # make docker-remove
12
13 UNAME := $(shell uname)
14 XARGS = xargs
15 ARCH ?= $(shell go env GOARCH)
16
17 # -r is only necessary on GNU xargs.
18 ifeq ($(UNAME), Linux)
19 XARGS += -r
20 endif
21 XARGS += rm -r
22
23 .PHONY: build
24 build:
25 GO_BUILD_FLAGS="-v" ./build.sh
26 ./bin/etcd --version
27 ./bin/etcdctl version
28 ./bin/etcdutl version
29
30 clean:
31 rm -f ./codecov
32 rm -rf ./covdir
33 rm -f ./bin/Dockerfile-release*
34 rm -rf ./bin/etcd*
35 rm -rf ./default.etcd
36 rm -rf ./tests/e2e/default.etcd
37 rm -rf ./release
38 rm -rf ./coverage/*.err ./coverage/*.out
39 rm -rf ./tests/e2e/default.proxy
40 rm -rf ./bin/shellcheck*
41 find ./ -name "127.0.0.1:*" -o -name "localhost:*" -o -name "*.log" -o -name "agent-*" -o -name "*.coverprofile" -o -name "testname-proxy-*" | $(XARGS)
42
43 docker-clean:
44 docker images
45 docker image prune --force
46
47 docker-start:
48 service docker restart
49
50 docker-kill:
51 docker kill `docker ps -q` || true
52
53 docker-remove:
54 docker rm --force `docker ps -a -q` || true
55 docker rmi --force `docker images -q` || true
56
57
58
59 GO_VERSION ?= $(shell cat .go-version)
60 ETCD_VERSION ?= $(shell git rev-parse --short HEAD || echo "GitNotFound")
61
62 TEST_SUFFIX = $(shell date +%s | base64 | head -c 15)
63 TEST_OPTS ?= PASSES='unit'
64
65 TMP_DIR_MOUNT_FLAG = --tmpfs=/tmp:exec
66 ifdef HOST_TMP_DIR
67 TMP_DIR_MOUNT_FLAG = --mount type=bind,source=$(HOST_TMP_DIR),destination=/tmp
68 endif
69
70
71 TMP_DOCKERFILE:=$(shell mktemp)
72
73 # Example:
74 # GO_VERSION=1.14.3 make build-docker-test
75 # make build-docker-test
76 #
77 # gcloud auth configure-docker
78 # GO_VERSION=1.14.3 make push-docker-test
79 # make push-docker-test
80 #
81 # gsutil -m acl ch -u allUsers:R -r gs://artifacts.etcd-development.appspot.com
82 # make pull-docker-test
83
84 build-docker-test:
85 $(info GO_VERSION: $(GO_VERSION))
86 @sed 's|REPLACE_ME_GO_VERSION|$(GO_VERSION)|g' ./tests/Dockerfile > $(TMP_DOCKERFILE)
87 docker build \
88 --network=host \
89 --tag gcr.io/etcd-development/etcd-test:go$(GO_VERSION) \
90 --file $(TMP_DOCKERFILE) .
91
92 push-docker-test:
93 $(info GO_VERSION: $(GO_VERSION))
94 docker push gcr.io/etcd-development/etcd-test:go$(GO_VERSION)
95
96 pull-docker-test:
97 $(info GO_VERSION: $(GO_VERSION))
98 docker pull gcr.io/etcd-development/etcd-test:go$(GO_VERSION)
99
100
101
102 # Example:
103 # make build-docker-test
104 # make compile-with-docker-test
105 # make compile-setup-gopath-with-docker-test
106
107 compile-with-docker-test:
108 $(info GO_VERSION: $(GO_VERSION))
109 docker run \
110 --rm \
111 --mount type=bind,source=`pwd`,destination=/go/src/go.etcd.io/etcd \
112 gcr.io/etcd-development/etcd-test:go$(GO_VERSION) \
113 /bin/bash -c "GO_BUILD_FLAGS=-v GOOS=linux GOARCH=amd64 ./build.sh && ./bin/etcd --version"
114
115 compile-setup-gopath-with-docker-test:
116 $(info GO_VERSION: $(GO_VERSION))
117 docker run \
118 --rm \
119 --mount type=bind,source=`pwd`,destination=/etcd \
120 gcr.io/etcd-development/etcd-test:go$(GO_VERSION) \
121 /bin/bash -c "cd /etcd && ETCD_SETUP_GOPATH=1 GO_BUILD_FLAGS=-v GOOS=linux GOARCH=amd64 ./build.sh && ./bin/etcd --version && rm -rf ./gopath"
122
123
124
125 # Example:
126 #
127 # Local machine:
128 # TEST_OPTS="PASSES='fmt'" make test
129 # TEST_OPTS="PASSES='fmt bom dep build unit'" make test
130 # TEST_OPTS="PASSES='build unit release integration_e2e functional'" make test
131 # TEST_OPTS="PASSES='build grpcproxy'" make test
132 #
133 # Example (test with docker):
134 # make pull-docker-test
135 # TEST_OPTS="PASSES='fmt'" make docker-test
136 # TEST_OPTS="VERBOSE=2 PASSES='unit'" make docker-test
137 #
138 # Travis CI (test with docker):
139 # TEST_OPTS="PASSES='fmt bom dep build unit'" make docker-test
140 #
141 # Semaphore CI (test with docker):
142 # TEST_OPTS="PASSES='build unit release integration_e2e functional'" make docker-test
143 # HOST_TMP_DIR=/tmp TEST_OPTS="PASSES='build unit release integration_e2e functional'" make docker-test
144 # TEST_OPTS="GOARCH=386 PASSES='build unit integration_e2e'" make docker-test
145 #
146 # grpc-proxy tests (test with docker):
147 # TEST_OPTS="PASSES='build grpcproxy'" make docker-test
148 # HOST_TMP_DIR=/tmp TEST_OPTS="PASSES='build grpcproxy'" make docker-test
149
150 .PHONY: test
151 test:
152 $(info TEST_OPTS: $(TEST_OPTS))
153 $(info log-file: test-$(TEST_SUFFIX).log)
154 $(TEST_OPTS) ./test.sh 2>&1 | tee test-$(TEST_SUFFIX).log
155 ! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 test-$(TEST_SUFFIX).log
156
157 test-smoke:
158 $(info log-file: test-$(TEST_SUFFIX).log)
159 PASSES="dep build unit" ./test.sh 2<&1 | tee test-$(TEST_SUFFIX).log
160 ! grep "FAIL:" test-$(TEST_SUFFIX).log
161
162 test-full:
163 $(info log-file: test-$(TEST_SUFFIX).log)
164 PASSES="fmt build release unit integration functional e2e grpcproxy" ./test.sh 2<&1 | tee test-$(TEST_SUFFIX).log
165
166 .PHONY: test-unit
167 test-unit:
168 PASSES="unit" ./test.sh $(GO_TEST_FLAGS)
169
170 .PHONY: test-integration
171 test-integration:
172 PASSES="integration" ./test.sh $(GO_TEST_FLAGS)
173
174 .PHONY: test-e2e
175 test-e2e:
176 PASSES="build e2e" ./test.sh $(GO_TEST_FLAGS)
177
178 .PHONY: test-grpcproxy-integration
179 test-grpcproxy-integration:
180 PASSES='build grpcproxy_integration' RACE='true' ./test.sh $(GO_TEST_FLAGS)
181
182 .PHONY: test-grpcproxy-e2e
183 test-grpcproxy-e2e:
184 PASSES='build grpcproxy_e2e' RACE='true' ./test.sh $(GO_TEST_FLAGS)
185
186 .PHONY: test-e2e-release
187 test-e2e-release:
188 PASSES="build release e2e" ./test.sh $(GO_TEST_FLAGS)
189
190 .PHONY: test-release
191 test-release:
192 PASSES="release_tests" ./test.sh $(GO_TEST_FLAGS)
193
194 ensure-docker-test-image-exists:
195 make pull-docker-test || ( echo "WARNING: Container Image not found in registry, building locally"; make build-docker-test )
196
197 docker-test: ensure-docker-test-image-exists
198 $(info GO_VERSION: $(GO_VERSION))
199 $(info ETCD_VERSION: $(ETCD_VERSION))
200 $(info TEST_OPTS: $(TEST_OPTS))
201 $(info log-file: test-$(TEST_SUFFIX).log)
202 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
203 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
204 docker run \
205 --rm \
206 $(TMP_DIR_MOUNT_FLAG) \
207 --mount type=bind,source=`pwd`,destination=/go/src/go.etcd.io/etcd \
208 gcr.io/etcd-development/etcd-test:go$(GO_VERSION) \
209 /bin/bash -c "$(TEST_OPTS) ./test.sh 2>&1 | tee test-$(TEST_SUFFIX).log"
210 ! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 test-$(TEST_SUFFIX).log
211
212 docker-test-coverage:
213 $(info GO_VERSION: $(GO_VERSION))
214 $(info ETCD_VERSION: $(ETCD_VERSION))
215 $(info log-file: docker-test-coverage-$(TEST_SUFFIX).log)
216 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
217 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
218 docker run \
219 --rm \
220 $(TMP_DIR_MOUNT_FLAG) \
221 --mount type=bind,source=`pwd`,destination=/go/src/go.etcd.io/etcd \
222 gcr.io/etcd-development/etcd-test:go$(GO_VERSION) \
223 /bin/bash ./scripts/codecov_upload.sh docker-test-coverage-$(TEST_SUFFIX).log \
224 ! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 docker-test-coverage-$(TEST_SUFFIX).log
225
226
227
228 # Example:
229 # make compile-with-docker-test
230 # ETCD_VERSION=v3-test make build-docker-release-main
231 # ETCD_VERSION=v3-test make push-docker-release-main
232 # gsutil -m acl ch -u allUsers:R -r gs://artifacts.etcd-development.appspot.com
233
234 build-docker-release-main:
235 $(info ETCD_VERSION: $(ETCD_VERSION))
236 cp ./Dockerfile-release.$(ARCH) ./bin/Dockerfile-release.$(ARCH)
237 docker build \
238 --network=host \
239 --tag gcr.io/etcd-development/etcd:$(ETCD_VERSION) \
240 --file ./bin/Dockerfile-release.$(ARCH) \
241 ./bin
242 rm -f ./bin/Dockerfile-release.$(ARCH)
243
244 docker run \
245 --rm \
246 gcr.io/etcd-development/etcd:$(ETCD_VERSION) \
247 /bin/sh -c "/usr/local/bin/etcd --version && /usr/local/bin/etcdctl version && /usr/local/bin/etcdutl version"
248
249 push-docker-release-main:
250 $(info ETCD_VERSION: $(ETCD_VERSION))
251 docker push gcr.io/etcd-development/etcd:$(ETCD_VERSION)
252
253
254
255 # Example:
256 # make build-docker-test
257 # make compile-with-docker-test
258 # make build-docker-static-ip-test
259 #
260 # gcloud auth configure-docker
261 # make push-docker-static-ip-test
262 #
263 # gsutil -m acl ch -u allUsers:R -r gs://artifacts.etcd-development.appspot.com
264 # make pull-docker-static-ip-test
265 #
266 # make docker-static-ip-test-certs-run
267 # make docker-static-ip-test-certs-metrics-proxy-run
268
269 build-docker-static-ip-test:
270 $(info GO_VERSION: $(GO_VERSION))
271 @sed 's|REPLACE_ME_GO_VERSION|$(GO_VERSION)|g' ./tests/docker-static-ip/Dockerfile > $(TMP_DOCKERFILE)
272 docker build \
273 --network=host \
274 --tag gcr.io/etcd-development/etcd-static-ip-test:go$(GO_VERSION) \
275 --file ./tests/docker-static-ip/Dockerfile \
276 $(TMP_DOCKERFILE)
277
278 push-docker-static-ip-test:
279 $(info GO_VERSION: $(GO_VERSION))
280 docker push gcr.io/etcd-development/etcd-static-ip-test:go$(GO_VERSION)
281
282 pull-docker-static-ip-test:
283 $(info GO_VERSION: $(GO_VERSION))
284 docker pull gcr.io/etcd-development/etcd-static-ip-test:go$(GO_VERSION)
285
286 docker-static-ip-test-certs-run:
287 $(info GO_VERSION: $(GO_VERSION))
288 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
289 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
290 docker run \
291 --rm \
292 --tty \
293 $(TMP_DIR_MOUNT_FLAG) \
294 --mount type=bind,source=`pwd`/bin,destination=/etcd \
295 --mount type=bind,source=`pwd`/tests/docker-static-ip/certs,destination=/certs \
296 gcr.io/etcd-development/etcd-static-ip-test:go$(GO_VERSION) \
297 /bin/bash -c "cd /etcd && /certs/run.sh && rm -rf m*.etcd"
298
299 docker-static-ip-test-certs-metrics-proxy-run:
300 $(info GO_VERSION: $(GO_VERSION))
301 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
302 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
303 docker run \
304 --rm \
305 --tty \
306 $(TMP_DIR_MOUNT_FLAG) \
307 --mount type=bind,source=`pwd`/bin,destination=/etcd \
308 --mount type=bind,source=`pwd`/tests/docker-static-ip/certs-metrics-proxy,destination=/certs-metrics-proxy \
309 gcr.io/etcd-development/etcd-static-ip-test:go$(GO_VERSION) \
310 /bin/bash -c "cd /etcd && /certs-metrics-proxy/run.sh && rm -rf m*.etcd"
311
312
313
314 # Example:
315 # make build-docker-test
316 # make compile-with-docker-test
317 # make build-docker-dns-test
318 #
319 # gcloud auth configure-docker
320 # make push-docker-dns-test
321 #
322 # gsutil -m acl ch -u allUsers:R -r gs://artifacts.etcd-development.appspot.com
323 # make pull-docker-dns-test
324 #
325 # make docker-dns-test-insecure-run
326 # make docker-dns-test-certs-run
327 # make docker-dns-test-certs-gateway-run
328 # make docker-dns-test-certs-wildcard-run
329 # make docker-dns-test-certs-common-name-auth-run
330 # make docker-dns-test-certs-common-name-multi-run
331 # make docker-dns-test-certs-san-dns-run
332
333 build-docker-dns-test:
334 $(info GO_VERSION: $(GO_VERSION))
335 @sed 's|REPLACE_ME_GO_VERSION|$(GO_VERSION)|g' ./tests/docker-dns/Dockerfile > $(TMP_DOCKERFILE)
336 docker build \
337 --network=host \
338 --tag gcr.io/etcd-development/etcd-dns-test:go$(GO_VERSION) \
339 --file ./tests/docker-dns/Dockerfile \
340 $(TMP_DOCKERFILE)
341
342 docker run \
343 --rm \
344 --dns 127.0.0.1 \
345 gcr.io/etcd-development/etcd-dns-test:go$(GO_VERSION) \
346 /bin/bash -c "/etc/init.d/bind9 start && cat /dev/null >/etc/hosts && dig etcd.local"
347
348 push-docker-dns-test:
349 $(info GO_VERSION: $(GO_VERSION))
350 docker push gcr.io/etcd-development/etcd-dns-test:go$(GO_VERSION)
351
352 pull-docker-dns-test:
353 $(info GO_VERSION: $(GO_VERSION))
354 docker pull gcr.io/etcd-development/etcd-dns-test:go$(GO_VERSION)
355
356 docker-dns-test-insecure-run:
357 $(info GO_VERSION: $(GO_VERSION))
358 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
359 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
360 docker run \
361 --rm \
362 --tty \
363 --dns 127.0.0.1 \
364 $(TMP_DIR_MOUNT_FLAG) \
365 --mount type=bind,source=`pwd`/bin,destination=/etcd \
366 --mount type=bind,source=`pwd`/tests/docker-dns/insecure,destination=/insecure \
367 gcr.io/etcd-development/etcd-dns-test:go$(GO_VERSION) \
368 /bin/bash -c "cd /etcd && /insecure/run.sh && rm -rf m*.etcd"
369
370 docker-dns-test-certs-run:
371 $(info GO_VERSION: $(GO_VERSION))
372 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
373 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
374 docker run \
375 --rm \
376 --tty \
377 --dns 127.0.0.1 \
378 $(TMP_DIR_MOUNT_FLAG) \
379 --mount type=bind,source=`pwd`/bin,destination=/etcd \
380 --mount type=bind,source=`pwd`/tests/docker-dns/certs,destination=/certs \
381 gcr.io/etcd-development/etcd-dns-test:go$(GO_VERSION) \
382 /bin/bash -c "cd /etcd && /certs/run.sh && rm -rf m*.etcd"
383
384 docker-dns-test-certs-gateway-run:
385 $(info GO_VERSION: $(GO_VERSION))
386 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
387 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
388 docker run \
389 --rm \
390 --tty \
391 --dns 127.0.0.1 \
392 $(TMP_DIR_MOUNT_FLAG) \
393 --mount type=bind,source=`pwd`/bin,destination=/etcd \
394 --mount type=bind,source=`pwd`/tests/docker-dns/certs-gateway,destination=/certs-gateway \
395 gcr.io/etcd-development/etcd-dns-test:go$(GO_VERSION) \
396 /bin/bash -c "cd /etcd && /certs-gateway/run.sh && rm -rf m*.etcd"
397
398 docker-dns-test-certs-wildcard-run:
399 $(info GO_VERSION: $(GO_VERSION))
400 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
401 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
402 docker run \
403 --rm \
404 --tty \
405 --dns 127.0.0.1 \
406 $(TMP_DIR_MOUNT_FLAG) \
407 --mount type=bind,source=`pwd`/bin,destination=/etcd \
408 --mount type=bind,source=`pwd`/tests/docker-dns/certs-wildcard,destination=/certs-wildcard \
409 gcr.io/etcd-development/etcd-dns-test:go$(GO_VERSION) \
410 /bin/bash -c "cd /etcd && /certs-wildcard/run.sh && rm -rf m*.etcd"
411
412 docker-dns-test-certs-common-name-auth-run:
413 $(info GO_VERSION: $(GO_VERSION))
414 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
415 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
416 docker run \
417 --rm \
418 --tty \
419 --dns 127.0.0.1 \
420 $(TMP_DIR_MOUNT_FLAG) \
421 --mount type=bind,source=`pwd`/bin,destination=/etcd \
422 --mount type=bind,source=`pwd`/tests/docker-dns/certs-common-name-auth,destination=/certs-common-name-auth \
423 gcr.io/etcd-development/etcd-dns-test:go$(GO_VERSION) \
424 /bin/bash -c "cd /etcd && /certs-common-name-auth/run.sh && rm -rf m*.etcd"
425
426 docker-dns-test-certs-common-name-multi-run:
427 $(info GO_VERSION: $(GO_VERSION))
428 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
429 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
430 docker run \
431 --rm \
432 --tty \
433 --dns 127.0.0.1 \
434 $(TMP_DIR_MOUNT_FLAG) \
435 --mount type=bind,source=`pwd`/bin,destination=/etcd \
436 --mount type=bind,source=`pwd`/tests/docker-dns/certs-common-name-multi,destination=/certs-common-name-multi \
437 gcr.io/etcd-development/etcd-dns-test:go$(GO_VERSION) \
438 /bin/bash -c "cd /etcd && /certs-common-name-multi/run.sh && rm -rf m*.etcd"
439
440 docker-dns-test-certs-san-dns-run:
441 $(info GO_VERSION: $(GO_VERSION))
442 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
443 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
444 docker run \
445 --rm \
446 --tty \
447 --dns 127.0.0.1 \
448 $(TMP_DIR_MOUNT_FLAG) \
449 --mount type=bind,source=`pwd`/bin,destination=/etcd \
450 --mount type=bind,source=`pwd`/tests/docker-dns/certs-san-dns,destination=/certs-san-dns \
451 gcr.io/etcd-development/etcd-dns-test:go$(GO_VERSION) \
452 /bin/bash -c "cd /etcd && /certs-san-dns/run.sh && rm -rf m*.etcd"
453
454
455 # Example:
456 # make build-docker-test
457 # make compile-with-docker-test
458 # make build-docker-dns-srv-test
459 # gcloud auth configure-docker
460 # make push-docker-dns-srv-test
461 # gsutil -m acl ch -u allUsers:R -r gs://artifacts.etcd-development.appspot.com
462 # make pull-docker-dns-srv-test
463 # make docker-dns-srv-test-certs-run
464 # make docker-dns-srv-test-certs-gateway-run
465 # make docker-dns-srv-test-certs-wildcard-run
466
467 build-docker-dns-srv-test:
468 $(info GO_VERSION: $(GO_VERSION))
469 @sed 's|REPLACE_ME_GO_VERSION|$(GO_VERSION)|g' > $(TMP_DOCKERFILE)
470 docker build \
471 --network=host \
472 --tag gcr.io/etcd-development/etcd-dns-srv-test:go$(GO_VERSION) \
473 --file ./tests/docker-dns-srv/Dockerfile \
474 $(TMP_DOCKERFILE)
475
476 docker run \
477 --rm \
478 --dns 127.0.0.1 \
479 gcr.io/etcd-development/etcd-dns-srv-test:go$(GO_VERSION) \
480 /bin/bash -c "/etc/init.d/bind9 start && cat /dev/null >/etc/hosts && dig +noall +answer SRV _etcd-client-ssl._tcp.etcd.local && dig +noall +answer SRV _etcd-server-ssl._tcp.etcd.local && dig +noall +answer m1.etcd.local m2.etcd.local m3.etcd.local"
481
482 push-docker-dns-srv-test:
483 $(info GO_VERSION: $(GO_VERSION))
484 docker push gcr.io/etcd-development/etcd-dns-srv-test:go$(GO_VERSION)
485
486 pull-docker-dns-srv-test:
487 $(info GO_VERSION: $(GO_VERSION))
488 docker pull gcr.io/etcd-development/etcd-dns-srv-test:go$(GO_VERSION)
489
490 docker-dns-srv-test-certs-run:
491 $(info GO_VERSION: $(GO_VERSION))
492 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
493 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
494 docker run \
495 --rm \
496 --tty \
497 --dns 127.0.0.1 \
498 $(TMP_DIR_MOUNT_FLAG) \
499 --mount type=bind,source=`pwd`/bin,destination=/etcd \
500 --mount type=bind,source=`pwd`/tests/docker-dns-srv/certs,destination=/certs \
501 gcr.io/etcd-development/etcd-dns-srv-test:go$(GO_VERSION) \
502 /bin/bash -c "cd /etcd && /certs/run.sh && rm -rf m*.etcd"
503
504 docker-dns-srv-test-certs-gateway-run:
505 $(info GO_VERSION: $(GO_VERSION))
506 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
507 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
508 docker run \
509 --rm \
510 --tty \
511 --dns 127.0.0.1 \
512 $(TMP_DIR_MOUNT_FLAG) \
513 --mount type=bind,source=`pwd`/bin,destination=/etcd \
514 --mount type=bind,source=`pwd`/tests/docker-dns-srv/certs-gateway,destination=/certs-gateway \
515 gcr.io/etcd-development/etcd-dns-srv-test:go$(GO_VERSION) \
516 /bin/bash -c "cd /etcd && /certs-gateway/run.sh && rm -rf m*.etcd"
517
518 docker-dns-srv-test-certs-wildcard-run:
519 $(info GO_VERSION: $(GO_VERSION))
520 $(info HOST_TMP_DIR: $(HOST_TMP_DIR))
521 $(info TMP_DIR_MOUNT_FLAG: $(TMP_DIR_MOUNT_FLAG))
522 docker run \
523 --rm \
524 --tty \
525 --dns 127.0.0.1 \
526 $(TMP_DIR_MOUNT_FLAG) \
527 --mount type=bind,source=`pwd`/bin,destination=/etcd \
528 --mount type=bind,source=`pwd`/tests/docker-dns-srv/certs-wildcard,destination=/certs-wildcard \
529 gcr.io/etcd-development/etcd-dns-srv-test:go$(GO_VERSION) \
530 /bin/bash -c "cd /etcd && /certs-wildcard/run.sh && rm -rf m*.etcd"
531
532
533
534 # Example:
535 # make build-functional
536 # make build-docker-functional
537 # make push-docker-functional
538 # make pull-docker-functional
539
540 build-functional:
541 $(info GO_VERSION: $(GO_VERSION))
542 $(info ETCD_VERSION: $(ETCD_VERSION))
543 ./tests/functional/build
544 ./bin/etcd-agent -help || true && \
545 ./bin/etcd-proxy -help || true && \
546 ./bin/etcd-runner --help || true && \
547 ./bin/etcd-tester -help || true
548
549 build-docker-functional:
550 $(info GO_VERSION: $(GO_VERSION))
551 $(info ETCD_VERSION: $(ETCD_VERSION))
552 @sed 's|REPLACE_ME_GO_VERSION|$(GO_VERSION)|g' > $(TMP_DOCKERFILE)
553 docker build \
554 --network=host \
555 --tag gcr.io/etcd-development/etcd-functional:go$(GO_VERSION) \
556 --file ./tests/functional/Dockerfile \
557 .
558 @mv ./tests/functional/Dockerfile.bak ./tests/functional/Dockerfile
559
560 docker run \
561 --rm \
562 gcr.io/etcd-development/etcd-functional:go$(GO_VERSION) \
563 /bin/bash -c "./bin/etcd --version && \
564 ./bin/etcd-failpoints --version && \
565 ./bin/etcdctl version && \
566 ./bin/etcdutl version && \
567 ./bin/etcd-agent -help || true && \
568 ./bin/etcd-proxy -help || true && \
569 ./bin/etcd-runner --help || true && \
570 ./bin/etcd-tester -help || true && \
571 ./bin/benchmark --help || true"
572
573 push-docker-functional:
574 $(info GO_VERSION: $(GO_VERSION))
575 $(info ETCD_VERSION: $(ETCD_VERSION))
576 docker push gcr.io/etcd-development/etcd-functional:go$(GO_VERSION)
577
578 pull-docker-functional:
579 $(info GO_VERSION: $(GO_VERSION))
580 $(info ETCD_VERSION: $(ETCD_VERSION))
581 docker pull gcr.io/etcd-development/etcd-functional:go$(GO_VERSION)
582
583 # Failpoints
584 GOFAIL_VERSION = $(shell cd tools/mod && go list -m -f {{.Version}} go.etcd.io/gofail)
585 .PHONY: install-gofail
586 install-gofail:
587 go install go.etcd.io/gofail@${GOFAIL_VERSION}
588
589 .PHONY: gofail-enable
590 gofail-enable: install-gofail
591 PASSES="toggle_failpoints" FAILPOINTS=true ./test.sh
592
593 .PHONY: gofail-disable
594 gofail-disable: install-gofail
595 PASSES="toggle_failpoints" ./test.sh
596
597 .PHONY: run-govulncheck
598 run-govulncheck:
599 ifeq (, $(shell which govulncheck))
600 $(shell go install golang.org/x/vuln/cmd/govulncheck@latest)
601 endif
602 PASSES="govuln" ./test.sh
603
604 # Static analysis
605
606 .PHONY: verify
607 verify: verify-gofmt verify-bom verify-dep verify-shellcheck verify-goword verify-govet verify-revive verify-license-header verify-receiver-name verify-mod-tidy verify-shellws verify-go-versions verify-markdown-marker
608
609 .PHONY: verify-gofmt
610 verify-gofmt:
611 PASSES="gofmt" ./test.sh
612
613 .PHONY: verify-bom
614 verify-bom:
615 PASSES="bom" ./test.sh
616
617 .PHONY: verify-shellcheck
618 verify-shellcheck:
619 PASSES="shellcheck" ./test.sh
620
621 .PHONY: verify-goword
622 verify-goword:
623 PASSES="goword" ./test.sh
624
625 .PHONY: verify-govet
626 verify-govet:
627 PASSES="govet" ./test.sh
628
629 .PHONY: verify-revive
630 verify-revive:
631 PASSES="revive" ./test.sh
632
633 .PHONY: verify-license-header
634 verify-license-header:
635 PASSES="license_header" ./test.sh
636
637 .PHONY: verify-receiver-name
638 verify-receiver-name:
639 PASSES="receiver_name" ./test.sh
640
641 .PHONY: verify-mod-tidy
642 verify-mod-tidy:
643 PASSES="mod_tidy" ./test.sh
644
645 .PHONY: verify-shellws
646 verify-shellws:
647 PASSES="shellws" ./test.sh
648
649 .PHONY: verify-markdown-marker
650 verify-markdown-marker:
651 PASSES="markdown_marker" ./test.sh
652
653 .PHONY: verify-go-versions
654 verify-go-versions:
655 ./scripts/verify_go_versions.sh
656
657 .PHONY: verify-dep
658 verify-dep:
659 PASSES="dep" ./test.sh 2<&1
660
661 .PHONY: fix
662 fix: sync-toolchain-directive
663 ./scripts/fix.sh
664
665 .PHONY: sync-toolchain-directive
666 sync-toolchain-directive:
667 ./scripts/sync_go_toolchain_directive.sh