You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by to...@apache.org on 2019/05/22 18:18:22 UTC

[impala] 01/04: IMPALA-8540: stop docker containers upon job end

This is an automated email from the ASF dual-hosted git repository.

todd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 3e9aa862d8870a76d89cb47ab5e26cac31dbe9b0
Author: Tim Armstrong <ta...@cloudera.com>
AuthorDate: Thu May 16 14:19:44 2019 -0700

    IMPALA-8540: stop docker containers upon job end
    
    This is based on the theory that IMPALA-8540 was caused by lingering
    docker containers that were left running after the job finished.
    
    Change-Id: Ibff3b807cbd700bd872cc57d9086ebb173daea36
    Reviewed-on: http://gerrit.cloudera.org:8080/13385
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
    Reviewed-by: Joe McDonnell <jo...@cloudera.com>
---
 bin/jenkins/dockerized-impala-run-tests.sh | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/bin/jenkins/dockerized-impala-run-tests.sh b/bin/jenkins/dockerized-impala-run-tests.sh
index f9fa287..d82ff98 100755
--- a/bin/jenkins/dockerized-impala-run-tests.sh
+++ b/bin/jenkins/dockerized-impala-run-tests.sh
@@ -22,19 +22,30 @@
 # It has been tested on Ubuntu 16.04.
 set -x
 set -eu -o pipefail
+
+DOCKER_NETWORK="test-impala-cluster"
+
 # Helper to source impala-config.sh, which may have unbound variables
 source_impala_config() {
   set +u
   . ./bin/impala-config.sh
   set -u
 }
+
+onexit() {
+  # Clean up docker containers and networks that may have been created by
+  # these tests.
+  docker rm -f $(docker ps -a -q) || true
+  docker network rm $DOCKER_NETWORK || true
+}
+trap onexit EXIT
+
 source_impala_config
 
 # Check that docker is running and that our user can interact with it.
 docker run hello-world
 
 # Set up the test network.
-DOCKER_NETWORK="test-impala-cluster"
 ./docker/configure_test_network.sh $DOCKER_NETWORK
 
 # Pick up the new variables.