Merge branch '6061-add-performance-plots' refs #6061
[arvados-dev.git] / jenkins / run-docker-tests.sh
index 8ff87369ea0a0de3e79e44fedcfc839d478c1320..5be7b995cc2467b8f2efb47624fa88b780b3a4ff 100755 (executable)
@@ -8,25 +8,67 @@ 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
 
-# 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)
+  if [[ "$ECODE" != "0" ]]; then
+    title "!!!!!! docker push $* failed !!!!!!"
+    EXITCODE=$(($EXITCODE + $ECODE))
+  fi
+}
 
-# clean up build files so we can re-build
-rm -f $WORKSPACE/docker/*-image
+timer_reset() {
+    t0=$SECONDS
+}
 
-rm -f docker/config.yml
+timer() {
+    echo -n "$(($SECONDS - $t0))s"
+}
 
-# Get test config.yml file
-cp $HOME/docker/config.yml docker/
+# Sanity check
+if ! [[ -n "$WORKSPACE" ]]; then
+  echo >&2
+  echo >&2 "Error: WORKSPACE environment variable not set"
+  echo >&2
+  exit 1
+fi
+
+echo $WORKSPACE
 
-# DOCS
+# find the docker binary
+DOCKER=`which docker.io`
+
+if [[ "$DOCKER" == "" ]]; then
+  DOCKER=`which docker`
+fi
+
+if [[ "$DOCKER" == "" ]]; then
+  title "Error: you need to have docker installed. Could not find the docker executable."
+  exit 1
+fi
+
+# DOCKER
 title "Starting docker build"
+
+timer_reset
+
+# 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=$?
@@ -36,6 +78,51 @@ if [[ "$ECODE" != "0" ]]; then
   EXITCODE=$(($EXITCODE + $ECODE))
 fi
 
-title "docker build complete"
+title "docker build complete (`timer`)"
+
+title "uploading images"
+
+timer_reset
+
+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/keepproxy
+  docker_push arvados/shell
+  docker_push arvados/sso
+else
+  title "upload arvados images SKIPPED because build failed"
+fi
+
+title "upload arvados images complete (`timer`)"
+
+title "Starting docker java-bwa-samtools build"
+
+timer_reset
+
+./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 (`timer`)"
+
+title "upload arvados/jobs image"
+
+timer_reset
+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 (`timer`)"
 
 exit $EXITCODE