From d86f0d9b6d3b8d1077d6fb23b8f94e072ef1ba28 Mon Sep 17 00:00:00 2001 From: John Howard Date: Thu, 18 Feb 2016 11:58:56 -0800 Subject: [PATCH] Check in latest Win2Lin Jenkins scripts Signed-off-by: John Howard --- hack/Jenkins/W2L/postbuild.sh | 35 +++++++++++++++++++++++++++++++++++ hack/Jenkins/W2L/setup.sh | 14 ++++++++------ 2 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 hack/Jenkins/W2L/postbuild.sh diff --git a/hack/Jenkins/W2L/postbuild.sh b/hack/Jenkins/W2L/postbuild.sh new file mode 100644 index 0000000000..f228b008c6 --- /dev/null +++ b/hack/Jenkins/W2L/postbuild.sh @@ -0,0 +1,35 @@ +set +x +set +e + +echo "" +echo "" +echo "---" +echo "Now starting POST-BUILD steps" +echo "---" +echo "" + +echo INFO: Pointing to $DOCKER_HOST + +if [ ! $(docker ps -aq | wc -l) -eq 0 ]; then + echo INFO: Removing containers... + ! docker rm -vf $(docker ps -aq) +fi + +# Remove all images which don't have docker or ubuntu in the name +if [ ! $(docker images | sed -n '1!p' | grep -v 'docker' | grep -v 'ubuntu' | awk '{ print $3 }' | wc -l) -eq 0 ]; then + echo INFO: Removing images... + ! docker rmi -f $(docker images | sed -n '1!p' | grep -v 'docker' | grep -v 'ubuntu' | awk '{ print $3 }') +fi + +# Kill off any instances of git, go and docker, just in case +! taskkill -F -IM git.exe -T >& /dev/null +! taskkill -F -IM go.exe -T >& /dev/null +! taskkill -F -IM docker.exe -T >& /dev/null + +# Remove everything +! cd /c/jenkins/gopath/src/github.com/docker/docker +! rm -rfd * >& /dev/null +! rm -rfd .* >& /dev/null + +echo INFO: Cleanup complete +exit 0 \ No newline at end of file diff --git a/hack/Jenkins/W2L/setup.sh b/hack/Jenkins/W2L/setup.sh index e46ffee4d5..90bab5ebd7 100644 --- a/hack/Jenkins/W2L/setup.sh +++ b/hack/Jenkins/W2L/setup.sh @@ -1,7 +1,8 @@ # Jenkins CI script for Windows to Linux CI. # Heavily modified by John Howard (@jhowardmsft) December 2015 to try to make it more reliable. set +x -SCRIPT_VER="4-Jan-2016 15:19 PST" +set +e +SCRIPT_VER="18-Feb-2016 11:47 PST" # TODO to make (even) more resilient: # - Check if jq is installed @@ -18,6 +19,7 @@ SCRIPT_VER="4-Jan-2016 15:19 PST" # - Tidy up of images and containers. Either here, or in the teardown script. ec=0 +uniques=1 echo INFO: Started at `date`. Script version $SCRIPT_VER # get the ip @@ -212,22 +214,22 @@ fi GOVER_DOCKERFILE=`grep 'ENV GO_VERSION' Dockerfile | awk '{print $3}'` GOVER_INSTALLED=`go version | awk '{print $3}'` if [ "${GOVER_INSTALLED:2}" != "$GOVER_DOCKERFILE" ]; then - ec=1 # Uncomment to make CI fail once all nodes are updated. + #ec=1 # Uncomment to make CI fail once all nodes are updated. echo echo "---------------------------------------------------------------------------" - echo "ERROR: CI should be using go version $GOVER_DOCKERFILE, but is using ${GOVER_INSTALLED:2}" - echo " This is currently a warning, but should (will) become an error in the future." + echo "WARN: CI should be using go version $GOVER_DOCKERFILE, but is using ${GOVER_INSTALLED:2}" + echo " Please ping #docker-maintainers on IRC to get this CI server updated." echo "---------------------------------------------------------------------------" echo fi # Check the Linux box is running a matching version of docker if [ "$uniques" -ne 1 ]; then - ec=1 # Uncomment to make CI fail once all nodes are updated. + ec=0 # Uncomment to make CI fail once all nodes are updated. echo echo "---------------------------------------------------------------------------" echo "ERROR: This CI node is not running the same version of docker as the daemon." - echo " This is a CI configuration issue" + echo " This is a CI configuration issue." echo "---------------------------------------------------------------------------" echo fi