diff --git a/hack/Jenkins/W2L/postbuild.sh b/hack/Jenkins/W2L/postbuild.sh index f228b008c6..662e2dcc37 100644 --- a/hack/Jenkins/W2L/postbuild.sh +++ b/hack/Jenkins/W2L/postbuild.sh @@ -15,10 +15,10 @@ if [ ! $(docker ps -aq | wc -l) -eq 0 ]; then ! 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 +# Remove all images which don't have docker or debian in the name +if [ ! $(docker images | sed -n '1!p' | grep -v 'docker' | grep -v 'debian' | 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 }') + ! docker rmi -f $(docker images | sed -n '1!p' | grep -v 'docker' | grep -v 'debian' | awk '{ print $3 }') fi # Kill off any instances of git, go and docker, just in case diff --git a/hack/Jenkins/W2L/setup.sh b/hack/Jenkins/W2L/setup.sh index 91fa3423b0..30e5884d97 100644 --- a/hack/Jenkins/W2L/setup.sh +++ b/hack/Jenkins/W2L/setup.sh @@ -1,9 +1,9 @@ # Jenkins CI script for Windows to Linux CI. # Heavily modified by John Howard (@jhowardmsft) December 2015 to try to make it more reliable. set +xe -SCRIPT_VER="Thu Feb 25 18:54:57 UTC 2016" +SCRIPT_VER="Wed Apr 20 18:30:19 UTC 2016" -# TODO to make (even) more resilient: +# TODO to make (even) more resilient: # - Wait for daemon to be running before executing docker commands # - Check if jq is installed # - Make sure bash is v4.3 or later. Can't do until all Azure nodes on the latest version @@ -78,7 +78,7 @@ if [ $ec -eq 0 ]; then ping $ip else echo "INFO: The Linux nodes outer daemon replied to a ping. Good!" - fi + fi fi # Get the version from the remote node. Note this may fail if jq is not installed. @@ -103,6 +103,16 @@ if [ $ec -eq 0 ]; then fi fi +# Are we in split binary mode? +if [ `grep DOCKER_CLIENTONLY Makefile | wc -l` -gt 0 ]; then + splitBinary=0 + echo "INFO: Running in single binary mode" +else + splitBinary=1 + echo "INFO: Running in split binary mode" +fi + + # Get the commit has and verify we have something if [ $ec -eq 0 ]; then export COMMITHASH=$(git rev-parse --short HEAD) @@ -119,31 +129,32 @@ fi # will cause CI to fail from Windows to Linux. Obviously it's not best practice to ever run as local system... if [ $ec -eq 0 ]; then export TEMP=/c/CI/CI-$COMMITHASH - export TMP=$TMP + export TMP=$TEMP /usr/bin/mkdir -p $TEMP # Make sure Linux mkdir for -p fi # Tidy up time if [ $ec -eq 0 ]; then echo INFO: Deleting pre-existing containers and images... + # Force remove all containers based on a previously built image with this commit ! docker rm -f $(docker ps -aq --filter "ancestor=docker:$COMMITHASH") &>/dev/null - + # Force remove any container with this commithash as a name ! docker rm -f $(docker ps -aq --filter "name=docker-$COMMITHASH") &>/dev/null - # Force remove the image if it exists - ! docker rmi -f "docker-$COMMITHASH" &>/dev/null - # This SHOULD never happen, but just in case, also blow away any containers # that might be around. - ! if [ ! `docker ps -aq | wc -l` -eq 0 ]; then + ! if [ ! $(docker ps -aq | wc -l) -eq 0 ]; then echo WARN: There were some leftover containers. Cleaning them up. ! docker rm -f $(docker ps -aq) fi + + # Force remove the image if it exists + ! docker rmi -f "docker-$COMMITHASH" &>/dev/null fi -# Provide the docker version for debugging purposes. If these fail, game over. +# Provide the docker version for debugging purposes. If these fail, game over. # as the Linux box isn't responding for some reason. if [ $ec -eq 0 ]; then echo INFO: Docker version and info of the outer daemon on the Linux node @@ -170,8 +181,26 @@ fi # build the daemon image if [ $ec -eq 0 ]; then echo "INFO: Running docker build on Linux host at $DOCKER_HOST" - set -x - docker build --rm --force-rm -t "docker:$COMMITHASH" . + if [ $splitBinary -eq 0 ]; then + set -x + docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t "docker:$COMMITHASH" . + cat <