Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. # run makefile from repo root
  2. .PHONY: build
  3. build:
  4. GO_BUILD_FLAGS="-v" ./build
  5. ./bin/etcd --version
  6. ETCDCTL_API=3 ./bin/etcdctl version
  7. # run all tests
  8. test-all:
  9. RELEASE_TEST=y INTEGRATION=y PASSES='build unit release integration_e2e functional' ./test 2>&1 | tee test.log
  10. # clean up failed tests, logs, dependencies
  11. clean:
  12. rm -f ./*.log
  13. rm -f ./bin/Dockerfile-release
  14. rm -rf ./gopath
  15. rm -rf ./release
  16. rm -f ./integration/127.0.0.1:* ./integration/localhost:*
  17. rm -f ./clientv3/integration/127.0.0.1:* ./clientv3/integration/localhost:*
  18. rm -f ./clientv3/ordering/127.0.0.1:* ./clientv3/ordering/localhost:*
  19. # keep in-sync with 'Dockerfile-test', 'e2e/docker-dns/Dockerfile'
  20. _GO_VERSION = go1.9.1
  21. ifdef GO_VERSION
  22. _GO_VERSION = $(GO_VERSION)
  23. endif
  24. # build base container image for testing on Linux
  25. docker-test-build:
  26. docker build --tag gcr.io/etcd-development/etcd-test:$(_GO_VERSION) --file ./Dockerfile-test .
  27. # e.g.
  28. # gcloud docker -- login -u _json_key -p "$(cat /etc/gcp-key-etcd.json)" https://gcr.io
  29. docker-test-push:
  30. gcloud docker -- push gcr.io/etcd-development/etcd-test:$(_GO_VERSION)
  31. docker-test-pull:
  32. docker pull gcr.io/etcd-development/etcd-test:$(_GO_VERSION)
  33. # compile etcd and etcdctl with Linux
  34. docker-test-compile:
  35. docker run \
  36. --rm \
  37. --volume=`pwd`/:/etcd \
  38. gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
  39. /bin/bash -c "cd /etcd && GO_BUILD_FLAGS=-v ./build && ./bin/etcd --version"
  40. # run tests inside container
  41. docker-test:
  42. docker run \
  43. --rm \
  44. --volume=`pwd`:/go/src/github.com/coreos/etcd \
  45. gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
  46. /bin/bash -c "RELEASE_TEST=y INTEGRATION=y PASSES='build unit release integration_e2e functional' ./test 2>&1 | tee docker-test.log"
  47. docker-test-386:
  48. docker run \
  49. --rm \
  50. --volume=`pwd`:/go/src/github.com/coreos/etcd \
  51. gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
  52. /bin/bash -c "GOARCH=386 PASSES='build unit integration_e2e' ./test 2>&1 | tee docker-test.log"
  53. # build release container image with Linux
  54. _ETCD_VERSION ?= $(shell git rev-parse --short HEAD || echo "GitNotFound")
  55. ifdef ETCD_VERSION
  56. _ETCD_VERSION = $(ETCD_VERSION)
  57. endif
  58. docker-release-master-build: docker-test-compile
  59. cp ./Dockerfile-release ./bin/Dockerfile-release
  60. docker build \
  61. --tag gcr.io/etcd-development/etcd:$(_ETCD_VERSION) \
  62. --file ./bin/Dockerfile-release \
  63. ./bin
  64. rm -f ./bin/Dockerfile-release
  65. docker run \
  66. --rm \
  67. gcr.io/etcd-development/etcd:$(_ETCD_VERSION) \
  68. /bin/sh -c "/usr/local/bin/etcd --version && ETCDCTL_API=3 /usr/local/bin/etcdctl version"
  69. docker-release-master-push:
  70. gcloud docker -- push gcr.io/etcd-development/etcd:$(_ETCD_VERSION)
  71. # build base container image for DNS testing
  72. docker-dns-test-build:
  73. docker build \
  74. --tag gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) \
  75. --file ./e2e/docker-dns/Dockerfile \
  76. ./e2e/docker-dns
  77. docker run \
  78. --rm \
  79. --dns 127.0.0.1 \
  80. gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) \
  81. /bin/bash -c "/etc/init.d/bind9 start && cat /dev/null >/etc/hosts && dig etcd.local"
  82. docker-dns-test-push:
  83. gcloud docker -- push gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION)
  84. docker-dns-test-pull:
  85. docker pull gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION)
  86. # run DNS tests inside container
  87. docker-dns-test-run:
  88. docker run \
  89. --rm \
  90. --tty \
  91. --dns 127.0.0.1 \
  92. --volume=`pwd`/bin:/etcd \
  93. --volume=`pwd`/integration/fixtures:/certs \
  94. gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) \
  95. /bin/bash -c "cd /etcd && /run.sh && rm -rf m*.etcd"
  96. # TODO: add DNS SRV tests
  97. # TODO: add DNS integration tests