Install PyYAML into VENVDIR for non-Python tests that use run_test_server.py. no...
[arvados-dev.git] / jenkins / run-docker-tests.sh
1 #!/bin/bash
2
3 EXITCODE=0
4
5 COLUMNS=80
6
7 title () {
8   printf "\n%*s\n\n" $(((${#title}+$COLUMNS)/2)) "********** $1 **********"
9 }
10
11 docker_push () {
12   # Sometimes docker push fails; retry it a few times if necessary.
13   for i in `seq 1 5`; do
14     $DOCKER push $*
15     ECODE=$?
16     if [[ "$ECODE" == "0" ]]; then
17       break
18     fi
19   done
20
21   if [[ "$ECODE" != "0" ]]; then
22     title "!!!!!! docker push $* failed !!!!!!"
23     EXITCODE=$(($EXITCODE + $ECODE))
24   fi
25 }
26
27 # Sanity check
28 if ! [[ -n "$WORKSPACE" ]]; then
29   echo >&2
30   echo >&2 "Error: WORKSPACE environment variable not set"
31   echo >&2
32   exit 1
33 fi
34
35 echo $WORKSPACE
36
37 # find the docker binary
38 DOCKER=`which docker.io`
39
40 if [[ "$DOCKER" == "" ]]; then
41   DOCKER=`which docker`
42 fi
43
44 if [[ "$DOCKER" == "" ]]; then
45   title "Error: you need to have docker installed. Could not find the docker executable."
46   exit 1
47 fi
48
49 # DOCKER
50 title "Starting docker build"
51
52 # clean up the docker build environment
53 cd "$WORKSPACE"
54 cd docker
55 ./build.sh realclean
56
57 rm -f config.yml
58
59 # Get test config.yml file
60 cp $HOME/docker/config.yml .
61
62 ./build.sh
63
64 ECODE=$?
65
66 if [[ "$ECODE" != "0" ]]; then
67   title "!!!!!! docker BUILD FAILED !!!!!!"
68   EXITCODE=$(($EXITCODE + $ECODE))
69 fi
70
71 title "docker build complete"
72
73 title "uploading images"
74
75 if [[ "$ECODE" == "0" ]]; then
76   docker_push arvados/api
77   docker_push arvados/compute
78   docker_push arvados/doc
79   docker_push arvados/workbench
80   docker_push arvados/keep
81   docker_push arvados/shell
82 else
83   title "upload arvados images SKIPPED because build failed"
84 fi
85
86 title "upload arvados images complete"
87
88 title "Starting docker java-bwa-samtools build"
89
90 ./build.sh java-bwa-samtools-image
91
92 ECODE=$?
93
94 if [[ "$ECODE" != "0" ]]; then
95   title "!!!!!! docker java-bwa-samtools BUILD FAILED !!!!!!"
96   EXITCODE=$(($EXITCODE + $ECODE))
97 fi
98
99 title "docker build java-bwa-samtools complete"
100
101 title "upload arvados/jobs image"
102
103 if [[ "$ECODE" == "0" ]]; then
104   docker_push arvados/jobs
105 else
106   title "upload arvados/jobs image SKIPPED because build failed"
107 fi
108
109 title "upload arvados/jobs image complete"
110
111 exit $EXITCODE