aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2015-06-12 11:22:49 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2015-06-12 11:22:49 -0700
commit0ee84dc10feb0eeddc304d18638bbcf3faff8f04 (patch)
tree7e475db372dde4b7b4a0b181dc4ac6fff890fe05
parent9ce1fbcae571ff1086e9f2b32384dc9b0d694a36 (diff)
only keep docker containers for tests that failed
-rwxr-xr-xtools/jenkins/run_jenkins.sh18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/jenkins/run_jenkins.sh b/tools/jenkins/run_jenkins.sh
index a754015f40..57cec77424 100755
--- a/tools/jenkins/run_jenkins.sh
+++ b/tools/jenkins/run_jenkins.sh
@@ -47,15 +47,29 @@ then
FETCH_PULL_REQUEST_CMD="&& git fetch $GIT_URL refs/pull/$ghprbPullId/merge refs/pull/$ghprbPullId/head"
fi
+ # Make sure the CID file is gone.
+ rm -f docker.cid
+
# Run tests inside docker
- docker run grpc/grpc_jenkins_slave bash -c -l "git clone --recursive $GIT_URL /var/local/git/grpc \
+ docker run --cidfile=docker.cid grpc/grpc_jenkins_slave bash -c -l "git clone --recursive $GIT_URL /var/local/git/grpc \
&& cd /var/local/git/grpc \
$FETCH_PULL_REQUEST_CMD \
&& git checkout -f $GIT_COMMIT \
&& git submodule update \
&& nvm use 0.12 \
&& rvm use ruby-2.1 \
- && tools/run_tests/run_tests.py -t -l $language"
+ && tools/run_tests/run_tests.py -t -l $language" || DOCKER_FAILED="true"
+
+ DOCKER_CID=`cat docker.cid`
+ if [ "$DOCKER_FAILED" == "" ]
+ then
+ echo "Docker finished successfully, deleting the container $DOCKER_CID"
+ docker rm $DOCKER_CID
+ else
+ echo "Docker exited with failure, keeping container $DOCKER_CID."
+ echo "You can SSH to the worker and use 'docker start CID' and 'docker exec -i -t CID bash' to debug the problem."
+ fi
+
elif [ "$platform" == "windows" ]
then
echo "building $language on Windows"