X-Git-Url: https://git.arvados.org/arvados-dev.git/blobdiff_plain/2e7d59676bf6098d0c3f277e450ffd38a0bf938d..27d5f6ed785b6e127cf9a2f1145fac21627a9a89:/jenkins/run-docker-tests.sh diff --git a/jenkins/run-docker-tests.sh b/jenkins/run-docker-tests.sh index fc7f789..0b5148e 100755 --- a/jenkins/run-docker-tests.sh +++ b/jenkins/run-docker-tests.sh @@ -8,25 +8,57 @@ title () { printf "\n%*s\n\n" $(((${#title}+$COLUMNS)/2)) "********** $1 **********" } -echo $WORKSPACE +docker_push () { + # Sometimes docker push fails; retry it a few times if necessary. + for i in `seq 1 5`; do + $DOCKER push $* + ECODE=$? + if [[ "$ECODE" == "0" ]]; then + break + fi + done + + if [[ "$ECODE" != "0" ]]; then + title "!!!!!! docker push $* failed !!!!!!" + EXITCODE=$(($EXITCODE + $ECODE)) + fi +} + +# Sanity check +if ! [[ -n "$WORKSPACE" ]]; then + echo >&2 + echo >&2 "Error: WORKSPACE environment variable not set" + echo >&2 + exit 1 +fi -# clean up existing docker containers and images -docker.io stop $(docker.io ps -a -q) -docker.io rm $(docker.io ps -a -q) -docker.io rmi $(docker.io images -q) +echo $WORKSPACE -# clean up build files so we can re-build -rm -f $WORKSPACE/docker/*-image +# find the docker binary +DOCKER=`which docker.io` -rm -f docker/config.yml +if [[ "$DOCKER" == "" ]]; then + DOCKER=`which docker` +fi -# Get test config.yml file -cp $HOME/docker/config.yml docker/ +if [[ "$DOCKER" == "" ]]; then + title "Error: you need to have docker installed. Could not find the docker executable." + exit 1 +fi -# DOCS +# DOCKER title "Starting docker build" + +# clean up the docker build environment cd "$WORKSPACE" cd docker +./build.sh realclean + +rm -f config.yml + +# Get test config.yml file +cp $HOME/docker/config.yml . + ./build.sh ECODE=$? @@ -38,3 +70,42 @@ fi title "docker build complete" +title "uploading images" + +if [[ "$ECODE" == "0" ]]; then + docker_push arvados/api + docker_push arvados/compute + docker_push arvados/doc + docker_push arvados/workbench + docker_push arvados/keep + docker_push arvados/shell +else + title "upload arvados images SKIPPED because build failed" +fi + +title "upload arvados images complete" + +title "Starting docker java-bwa-samtools build" + +./build.sh java-bwa-samtools-image + +ECODE=$? + +if [[ "$ECODE" != "0" ]]; then + title "!!!!!! docker java-bwa-samtools BUILD FAILED !!!!!!" + EXITCODE=$(($EXITCODE + $ECODE)) +fi + +title "docker build java-bwa-samtools complete" + +title "upload arvados/jobs image" + +if [[ "$ECODE" == "0" ]]; then + docker_push arvados/jobs +else + title "upload arvados/jobs image SKIPPED because build failed" +fi + +title "upload arvados/jobs image complete" + +exit $EXITCODE