-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8628 from gyuho/makefile
Makefile: initial commit
- Loading branch information
Showing
17 changed files
with
237 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM golang:1.9-stretch | ||
FROM golang:1.9.1-stretch | ||
|
||
RUN apt-get -y update | ||
RUN apt-get -y install \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
# run makefile from repo root | ||
|
||
.PHONY: build | ||
build: | ||
GO_BUILD_FLAGS="-v" ./build | ||
./bin/etcd --version | ||
ETCDCTL_API=3 ./bin/etcdctl version | ||
|
||
# run all tests | ||
test-all: | ||
RELEASE_TEST=y INTEGRATION=y PASSES='build unit release integration_e2e functional' ./test 2>&1 | tee test.log | ||
|
||
# clean up failed tests, logs, dependencies | ||
clean: | ||
rm -f ./*.log | ||
rm -f ./bin/Dockerfile-release | ||
rm -rf ./bin/*.etcd | ||
rm -rf ./gopath | ||
rm -rf ./release | ||
rm -f ./integration/127.0.0.1:* ./integration/localhost:* | ||
rm -f ./clientv3/integration/127.0.0.1:* ./clientv3/integration/localhost:* | ||
rm -f ./clientv3/ordering/127.0.0.1:* ./clientv3/ordering/localhost:* | ||
|
||
# keep in-sync with 'Dockerfile-test', 'e2e/docker-dns/Dockerfile', | ||
# 'e2e/docker-dns-srv/Dockerfile' | ||
_GO_VERSION = go1.9.1 | ||
ifdef GO_VERSION | ||
_GO_VERSION = $(GO_VERSION) | ||
endif | ||
|
||
# build base container image for testing on Linux | ||
docker-test-build: | ||
docker build --tag gcr.io/etcd-development/etcd-test:$(_GO_VERSION) --file ./Dockerfile-test . | ||
|
||
# e.g. | ||
# gcloud docker -- login -u _json_key -p "$(cat /etc/gcp-key-etcd.json)" https://gcr.io | ||
docker-test-push: | ||
gcloud docker -- push gcr.io/etcd-development/etcd-test:$(_GO_VERSION) | ||
|
||
docker-test-pull: | ||
docker pull gcr.io/etcd-development/etcd-test:$(_GO_VERSION) | ||
|
||
# compile etcd and etcdctl with Linux | ||
docker-test-compile: | ||
docker run \ | ||
--rm \ | ||
--volume=`pwd`/:/etcd \ | ||
gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \ | ||
/bin/bash -c "cd /etcd && GO_BUILD_FLAGS=-v ./build && ./bin/etcd --version" | ||
|
||
# run tests inside container | ||
docker-test: | ||
docker run \ | ||
--rm \ | ||
--volume=`pwd`:/go/src/github.com/coreos/etcd \ | ||
gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \ | ||
/bin/bash -c "RELEASE_TEST=y INTEGRATION=y PASSES='build unit release integration_e2e functional' ./test 2>&1 | tee docker-test.log" | ||
|
||
docker-test-386: | ||
docker run \ | ||
--rm \ | ||
--volume=`pwd`:/go/src/github.com/coreos/etcd \ | ||
gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \ | ||
/bin/bash -c "GOARCH=386 PASSES='build unit integration_e2e' ./test 2>&1 | tee docker-test.log" | ||
|
||
# build release container image with Linux | ||
_ETCD_VERSION ?= $(shell git rev-parse --short HEAD || echo "GitNotFound") | ||
ifdef ETCD_VERSION | ||
_ETCD_VERSION = $(ETCD_VERSION) | ||
endif | ||
docker-release-master-build: docker-test-compile | ||
cp ./Dockerfile-release ./bin/Dockerfile-release | ||
docker build \ | ||
--tag gcr.io/etcd-development/etcd:$(_ETCD_VERSION) \ | ||
--file ./bin/Dockerfile-release \ | ||
./bin | ||
rm -f ./bin/Dockerfile-release | ||
|
||
docker run \ | ||
--rm \ | ||
gcr.io/etcd-development/etcd:$(_ETCD_VERSION) \ | ||
/bin/sh -c "/usr/local/bin/etcd --version && ETCDCTL_API=3 /usr/local/bin/etcdctl version" | ||
|
||
docker-release-master-push: | ||
gcloud docker -- push gcr.io/etcd-development/etcd:$(_ETCD_VERSION) | ||
|
||
# build base container image for DNS testing | ||
docker-dns-test-build: | ||
docker build \ | ||
--tag gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) \ | ||
--file ./e2e/docker-dns/Dockerfile \ | ||
./e2e/docker-dns | ||
|
||
docker run \ | ||
--rm \ | ||
--dns 127.0.0.1 \ | ||
gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) \ | ||
/bin/bash -c "/etc/init.d/bind9 start && cat /dev/null >/etc/hosts && dig etcd.local" | ||
|
||
docker-dns-test-push: | ||
gcloud docker -- push gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) | ||
|
||
docker-dns-test-pull: | ||
docker pull gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) | ||
|
||
# run DNS tests inside container | ||
docker-dns-test-run: | ||
docker run \ | ||
--rm \ | ||
--tty \ | ||
--dns 127.0.0.1 \ | ||
--volume=`pwd`/bin:/etcd \ | ||
--volume=`pwd`/integration/fixtures:/certs \ | ||
gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) \ | ||
/bin/bash -c "cd /etcd && /run.sh && rm -rf m*.etcd" | ||
|
||
# build base container image for DNS/SRV testing | ||
docker-dns-srv-test-build: | ||
docker build \ | ||
--tag gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION) \ | ||
--file ./e2e/docker-dns-srv/Dockerfile \ | ||
./e2e/docker-dns-srv | ||
|
||
docker run \ | ||
--rm \ | ||
--dns 127.0.0.1 \ | ||
gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION) \ | ||
/bin/bash -c "/etc/init.d/bind9 start && cat /dev/null >/etc/hosts && dig +noall +answer SRV _etcd-client._tcp.etcd-srv.local && dig +noall +answer SRV _etcd-client-ssl._tcp.etcd-srv.local && dig +noall +answer SRV _etcd-server._tcp.etcd-srv.local && dig +noall +answer SRV _etcd-server-ssl._tcp.etcd-srv.local && dig +noall +answer m1.etcd-srv.local m2.etcd-srv.local m3.etcd-srv.local" | ||
|
||
docker-dns-srv-test-push: | ||
gcloud docker -- push gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION) | ||
|
||
docker-dns-srv-test-pull: | ||
docker pull gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION) | ||
|
||
# run DNS/SRV tests inside container | ||
docker-dns-srv-test-run: | ||
docker run \ | ||
--rm \ | ||
--tty \ | ||
--dns 127.0.0.1 \ | ||
--volume=`pwd`/bin:/etcd \ | ||
gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION) \ | ||
/bin/bash -c "cd /etcd && /run.sh && rm -rf m*.etcd" | ||
|
||
# TODO: run DNS/SRV with TLS | ||
# TODO: add DNS integration tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM golang:1.9-stretch | ||
LABEL Description="Image for etcd DNS SRV testing" | ||
|
||
RUN apt update -y \ | ||
&& apt install -y \ | ||
bind9 \ | ||
dnsutils | ||
|
||
RUN mkdir /var/bind | ||
RUN chown bind /var/bind | ||
ADD Procfile /Procfile | ||
ADD run.sh /run.sh | ||
|
||
ADD etcd.zone named.conf /etc/bind/ | ||
ADD resolv.conf /etc/resolv.conf | ||
|
||
RUN go get github.com/mattn/goreman | ||
CMD ["/run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
etcd1: ./etcd --name m1 --listen-client-urls http://127.0.0.1:2379 --advertise-client-urls http://m1.etcd-srv.local:2379 --listen-peer-urls http://127.0.0.1:2380 --initial-advertise-peer-urls=http://m1.etcd-srv.local:2380 --initial-cluster-token tkn --discovery-srv=etcd-srv.local --initial-cluster-state new | ||
|
||
etcd2: ./etcd --name m2 --listen-client-urls http://127.0.0.1:22379 --advertise-client-urls http://m2.etcd-srv.local:22379 --listen-peer-urls http://127.0.0.1:22380 --initial-advertise-peer-urls=http://m2.etcd-srv.local:22380 --initial-cluster-token tkn --discovery-srv=etcd-srv.local --initial-cluster-state new | ||
|
||
etcd3: ./etcd --name m3 --listen-client-urls http://127.0.0.1:32379 --advertise-client-urls http://m3.etcd-srv.local:32379 --listen-peer-urls http://127.0.0.1:32380 --initial-advertise-peer-urls=http://m3.etcd-srv.local:32380 --initial-cluster-token tkn --discovery-srv=etcd-srv.local --initial-cluster-state new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
etcd-srv.local. IN SOA bindhostname. admin.etcd-srv.local. ( | ||
1452607488 | ||
10800 | ||
3600 | ||
604800 | ||
38400 ) | ||
etcd-srv.local. IN NS bindhostname. | ||
m1.etcd-srv.local. 300 IN A 127.0.0.1 | ||
m2.etcd-srv.local. 300 IN A 127.0.0.1 | ||
m3.etcd-srv.local. 300 IN A 127.0.0.1 | ||
_etcd-client._tcp 300 IN SRV 0 0 2379 m1.etcd-srv.local. | ||
_etcd-client._tcp 300 IN SRV 0 0 22379 m2.etcd-srv.local. | ||
_etcd-client._tcp 300 IN SRV 0 0 32379 m3.etcd-srv.local. | ||
_etcd-client-ssl._tcp 300 IN SRV 0 0 2379 m1.etcd-srv.local. | ||
_etcd-client-ssl._tcp 300 IN SRV 0 0 22379 m2.etcd-srv.local. | ||
_etcd-client-ssl._tcp 300 IN SRV 0 0 32379 m3.etcd-srv.local. | ||
_etcd-server._tcp 300 IN SRV 0 0 2380 m1.etcd-srv.local. | ||
_etcd-server._tcp 300 IN SRV 0 0 22380 m2.etcd-srv.local. | ||
_etcd-server._tcp 300 IN SRV 0 0 32380 m3.etcd-srv.local. | ||
_etcd-server-ssl._tcp 300 IN SRV 0 0 2380 m1.etcd-srv.local. | ||
_etcd-server-ssl._tcp 300 IN SRV 0 0 22380 m2.etcd-srv.local. | ||
_etcd-server-ssl._tcp 300 IN SRV 0 0 32380 m3.etcd-srv.local. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
options { | ||
directory "/var/bind"; | ||
listen-on { 127.0.0.1; }; | ||
listen-on-v6 { none; }; | ||
allow-transfer { | ||
none; | ||
}; | ||
// If you have problems and are behind a firewall: | ||
query-source address * port 53; | ||
pid-file "/var/run/named/named.pid"; | ||
allow-recursion { none; }; | ||
recursion no; | ||
}; | ||
|
||
zone "etcd-srv.local" IN { | ||
type master; | ||
file "/etc/bind/etcd.zone"; | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
/etc/init.d/bind9 start | ||
# get rid of hosts so go lookup won't resolve 127.0.0.1 to localhost | ||
cat /dev/null >/etc/hosts | ||
goreman -f /Procfile start & | ||
sleep 5s | ||
./etcdctl --discovery-srv etcd-srv.local set foo bar | ||
ETCDCTL_API=3 ./etcdctl --discovery-srv etcd-srv.local put foo bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
FROM golang:1.9-stretch | ||
FROM golang:1.9.1-stretch | ||
LABEL Description="Image for etcd DNS testing" | ||
RUN apt update -y | ||
RUN go get github.com/mattn/goreman | ||
RUN apt install -y bind9 | ||
|
||
RUN apt update -y \ | ||
&& apt install -y \ | ||
bind9 \ | ||
dnsutils | ||
|
||
RUN mkdir /var/bind | ||
RUN chown bind /var/bind | ||
ADD Procfile.tls /Procfile.tls | ||
ADD run.sh /run.sh | ||
|
||
ADD named.conf etcd.zone rdns.zone /etc/bind/ | ||
ADD resolv.conf /etc/resolv.conf | ||
|
||
RUN go get github.com/mattn/goreman | ||
CMD ["/run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Use goreman to run `go get github.com/mattn/goreman` | ||
etcd1: ./etcd --name m1 --listen-client-urls https://127.0.0.1:2379 --advertise-client-urls https://m1.etcd.local:2379 --listen-peer-urls https://127.0.0.1:12380 --initial-advertise-peer-urls=https://m1.etcd.local:12380 --initial-cluster-token etcd-cluster-1 --initial-cluster=m1=https://m1.etcd.local:12380,m2=https://m2.etcd.local:22380,m3=https://m3.etcd.local:32380 --initial-cluster-state new --enable-pprof --peer-cert-file=/certs/server-wildcard.crt --peer-key-file=/certs/server-wildcard.key.insecure --peer-client-cert-auth --cert-file=/certs/server-wildcard.crt --key-file=/certs/server-wildcard.key.insecure --peer-trusted-ca-file=/certs/ca.crt --trusted-ca-file=/certs/ca.crt | ||
|
||
etcd2: ./etcd --name m2 --listen-client-urls https://127.0.0.1:22379 --advertise-client-urls https://m2.etcd.local:22379 --listen-peer-urls https://127.0.0.1:22380 --initial-advertise-peer-urls=https://m2.etcd.local:22380 --initial-cluster-token etcd-cluster-1 --initial-cluster=m1=https://m1.etcd.local:12380,m2=https://m2.etcd.local:22380,m3=https://m3.etcd.local:32380 --initial-cluster-state new --enable-pprof --peer-cert-file=/certs/server-wildcard.crt -peer-key-file=/certs/server-wildcard.key.insecure --peer-client-cert-auth --cert-file=/certs/server-wildcard.crt --key-file=/certs/server-wildcard.key.insecure --peer-trusted-ca-file=/certs/ca.crt --trusted-ca-file=/certs/ca.crt | ||
|
||
etcd3: ./etcd --name m3 --listen-client-urls https://127.0.0.1:32379 --advertise-client-urls https://m3.etcd.local:32379 --listen-peer-urls https://127.0.0.1:32380 --initial-advertise-peer-urls=https://m3.etcd.local:32380 --initial-cluster-token etcd-cluster-1 --initial-cluster=m1=https://m1.etcd.local:12380,m2=https://m2.etcd.local:22380,m3=https://m3.etcd.local:32380 --initial-cluster-state new --enable-pprof --peer-cert-file=/certs/server-wildcard.crt --peer-key-file=/certs/server-wildcard.key.insecure --peer-client-cert-auth --cert-file=/certs/server-wildcard.crt --key-file=/certs/server-wildcard.key.insecure --peer-trusted-ca-file=/certs/ca.crt --trusted-ca-file=/certs/ca.crt |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nameserver 127.0.0.1 |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.