From d1dadf70f417002334b8146a8413e474b319b044 Mon Sep 17 00:00:00 2001 From: Zach Loafman Date: Mon, 25 Apr 2016 10:46:59 -0700 Subject: [PATCH] Jenkins: Clean up even if we can't bring cluster up We're gathering all the cluster logs, go ahead and clean up the resources. --- hack/jenkins/e2e-runner.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hack/jenkins/e2e-runner.sh b/hack/jenkins/e2e-runner.sh index c7016d7d1b4..67716a66187 100755 --- a/hack/jenkins/e2e-runner.sh +++ b/hack/jenkins/e2e-runner.sh @@ -139,11 +139,21 @@ function install_google_cloud_sdk_tarball() { export PATH=${install_dir}/google-cloud-sdk/bin:${PATH} } +# Only call after attempting to bring the cluster up. Don't call after +# bringing the cluster down. function dump_cluster_logs_and_exit() { local -r exit_status=$? if [[ -x "cluster/log-dump.sh" ]]; then ./cluster/log-dump.sh "${ARTIFACTS}" fi + if [[ "${E2E_DOWN,,}" == "true" ]]; then + # If we tried to bring the cluster up, make a courtesy attempt + # to bring the cluster down so we're not leaving resources + # around. Unlike later, don't sleep beforehand, though. (We're + # just trying to tear down as many resources as we can as fast + # as possible and don't even know if we brought the master up.) + go run ./hack/e2e.go ${E2E_OPT:-} -v --down || true + fi exit ${exit_status} }