From 0c7b948317579735e1f15c11da096bef68c87b47 Mon Sep 17 00:00:00 2001 From: Antoine Cotten Date: Fri, 20 Jul 2018 20:08:32 +0200 Subject: [PATCH] Multiple optimizations to build targets * Clean up e2e test on interruption * Leverage GOCACHE for faster builds * Forward container STDIN in make targets --- .gitignore | 6 +++++- Makefile | 6 +++--- build/e2e-tests.sh | 1 + build/go-in-docker.sh | 1 + test/e2e/e2e.go | 6 ++++++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index feaadb183b..5c602f897b 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,8 @@ site # temporal github pages gh-pages -test/binaries \ No newline at end of file +# Docker-based builds +/test/binaries +/.env +/.gocache/ +/bin/ diff --git a/Makefile b/Makefile index 426970cb99..598b2dce98 100644 --- a/Makefile +++ b/Makefile @@ -168,7 +168,7 @@ static-check: test: @$(DEF_VARS) \ NODE_IP=$(NODE_IP) \ - DOCKER_OPTS="--net=host" \ + DOCKER_OPTS="-i --net=host" \ build/go-in-docker.sh build/test.sh .PHONY: lua-test @@ -182,14 +182,14 @@ e2e-test: @$(DEF_VARS) \ FOCUS=$(FOCUS) \ E2E_NODES=$(E2E_NODES) \ - DOCKER_OPTS="--net=host" \ + DOCKER_OPTS="-i --net=host" \ NODE_IP=$(NODE_IP) \ build/go-in-docker.sh build/e2e-tests.sh .PHONY: cover cover: @$(DEF_VARS) \ - DOCKER_OPTS="--net=host" \ + DOCKER_OPTS="-i --net=host" \ build/go-in-docker.sh build/cover.sh echo "Uploading coverage results..." diff --git a/build/e2e-tests.sh b/build/e2e-tests.sh index 9dc0fa9915..6201e59f65 100755 --- a/build/e2e-tests.sh +++ b/build/e2e-tests.sh @@ -52,6 +52,7 @@ fi ginkgo build ./test/e2e +exec -- \ ginkgo \ -randomizeSuites \ -randomizeAllSpecs \ diff --git a/build/go-in-docker.sh b/build/go-in-docker.sh index a289ab1026..1f092045fc 100755 --- a/build/go-in-docker.sh +++ b/build/go-in-docker.sh @@ -72,6 +72,7 @@ docker run \ -v ${HOME}/.kube:/${HOME}/.kube \ -v ${HOME}/.minikube:${HOME}/.minikube \ -v ${PWD}:/go/src/${PKG} \ + -v ${PWD}/.gocache:${HOME}/.cache/go-build \ -v ${PWD}/bin/${ARCH}:/go/bin/linux_${ARCH} \ -w /go/src/${PKG} \ --env-file .env \ diff --git a/test/e2e/e2e.go b/test/e2e/e2e.go index 33addec8e1..d423362546 100644 --- a/test/e2e/e2e.go +++ b/test/e2e/e2e.go @@ -53,3 +53,9 @@ func RunE2ETests(t *testing.T) { glog.Infof("Starting e2e run %q on Ginkgo node %d", framework.RunID, config.GinkgoConfig.ParallelNode) ginkgo.RunSpecs(t, "nginx-ingress-controller e2e suite") } + +var _ = ginkgo.SynchronizedAfterSuite(func() { + // Run on all Ginkgo nodes + framework.Logf("Running AfterSuite actions on all nodes") + framework.RunCleanupActions() +}, func() {})