Makefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 ./bin/*.etcd
  15. rm -rf ./gopath
  16. rm -rf ./release
  17. rm -f ./integration/127.0.0.1:* ./integration/localhost:*
  18. rm -f ./clientv3/integration/127.0.0.1:* ./clientv3/integration/localhost:*
  19. rm -f ./clientv3/ordering/127.0.0.1:* ./clientv3/ordering/localhost:*
  20. # keep in-sync with 'Dockerfile-test'
  21. _GO_VERSION = go1.8.4
  22. ifdef GO_VERSION
  23. _GO_VERSION = $(GO_VERSION)
  24. endif
  25. # build base container image for testing on Linux
  26. docker-test-build:
  27. docker build --tag gcr.io/etcd-development/etcd-test:$(_GO_VERSION) --file ./Dockerfile-test .
  28. # e.g.
  29. # gcloud docker -- login -u _json_key -p "$(cat /etc/gcp-key-etcd.json)" https://gcr.io
  30. docker-test-push:
  31. gcloud docker -- push gcr.io/etcd-development/etcd-test:$(_GO_VERSION)
  32. docker-test-pull:
  33. docker pull gcr.io/etcd-development/etcd-test:$(_GO_VERSION)
  34. # compile etcd and etcdctl with Linux
  35. docker-test-compile:
  36. docker run \
  37. --rm \
  38. --volume=`pwd`/:/etcd \
  39. gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
  40. /bin/bash -c "cd /etcd && GO_BUILD_FLAGS=-v ./build && ./bin/etcd --version"
  41. # run tests inside container
  42. docker-test:
  43. docker run \
  44. --rm \
  45. --volume=`pwd`:/go/src/github.com/coreos/etcd \
  46. gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
  47. /bin/bash -c "RELEASE_TEST=y INTEGRATION=y PASSES='build unit release integration_e2e functional' ./test 2>&1 | tee docker-test.log"
  48. docker-test-386:
  49. docker run \
  50. --rm \
  51. --volume=`pwd`:/go/src/github.com/coreos/etcd \
  52. gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
  53. /bin/bash -c "GOARCH=386 PASSES='build unit integration_e2e' ./test 2>&1 | tee docker-test.log"
  54. # build release container image with Linux
  55. _ETCD_VERSION ?= $(shell git rev-parse --short HEAD || echo "GitNotFound")
  56. ifdef ETCD_VERSION
  57. _ETCD_VERSION = $(ETCD_VERSION)
  58. endif
  59. docker-release-master-build: docker-test-compile
  60. cp ./Dockerfile-release ./bin/Dockerfile-release
  61. docker build \
  62. --tag gcr.io/etcd-development/etcd:$(_ETCD_VERSION) \
  63. --file ./bin/Dockerfile-release \
  64. ./bin
  65. rm -f ./bin/Dockerfile-release
  66. docker run \
  67. --rm \
  68. gcr.io/etcd-development/etcd:$(_ETCD_VERSION) \
  69. /bin/sh -c "/usr/local/bin/etcd --version && ETCDCTL_API=3 /usr/local/bin/etcdctl version"
  70. docker-release-master-push:
  71. gcloud docker -- push gcr.io/etcd-development/etcd:$(_ETCD_VERSION)