Make run-docker-tests.sh a bit smarter about detecting common failures.
authorWard Vandewege <ward@curoverse.com>
Sat, 1 Nov 2014 19:08:28 +0000 (15:08 -0400)
committerWard Vandewege <ward@curoverse.com>
Sat, 1 Nov 2014 19:10:44 +0000 (15:10 -0400)
No issue #

jenkins/run-docker-tests.sh

index 8fbf562c67421df8791fe810c094b8b93053eac6..8587996b4326f74df8fb4dfebfbf65d22fafabdf 100755 (executable)
@@ -9,7 +9,7 @@ title () {
 }
 
 docker_push () {
-  docker push $*
+  $DOCKER push $*
 
   ECODE=$?
 
@@ -19,8 +19,28 @@ docker_push () {
   fi
 }
 
+# Sanity check
+if ! [[ -n "$WORKSPACE" ]]; then
+  echo >&2
+  echo >&2 "Error: WORKSPACE environment variable not set"
+  echo >&2
+  exit 1
+fi
+
 echo $WORKSPACE
 
+# 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"