5 echo >&2 "usage: $0 [options]"
8 echo >&2 " -t, --tags [csv_tags] comma separated tags"
9 echo >&2 " -u, --upload Upload the images (docker push)"
10 echo >&2 " -h, --help Display this help and exit"
12 echo >&2 " If no options are given, just builds the images."
17 # NOTE: This requires GNU getopt (part of the util-linux package on Debian-based distros).
18 TEMP=`getopt -o hut: \
19 --long help,upload,tags: \
22 if [ $? != 0 ] ; then echo "Use -h for help"; exit 1 ; fi
23 # Note the quotes around `$TEMP': they are essential!
36 echo "ERROR: --tags needs a parameter";
66 . $WORKSPACE/build/run-library.sh
71 for tag in $( echo $tags|tr "," " " )
73 $DOCKER tag $1 $1:$tag
77 # Sometimes docker push fails; retry it a few times if necessary.
78 for i in `seq 1 5`; do
81 if [[ "$ECODE" == "0" ]]; then
86 if [[ "$ECODE" != "0" ]]; then
87 EXITCODE=$(($EXITCODE + $ECODE))
89 checkexit $ECODE "docker push $*"
93 if ! [[ -n "$WORKSPACE" ]]; then
95 echo >&2 "Error: WORKSPACE environment variable not set"
102 # find the docker binary
103 DOCKER=`which docker.io`
105 if [[ "$DOCKER" == "" ]]; then
106 DOCKER=`which docker`
109 if [[ "$DOCKER" == "" ]]; then
110 title "Error: you need to have docker installed. Could not find the docker executable."
115 title "Starting docker build"
119 # clean up the docker build environment
125 # Get test config.yml file
126 cp $HOME/docker/config.yml .
128 if [[ ! -z "$tags" ]]; then
129 COMMIT=${tags/,*/} ./build.sh jobs-image
131 ./build.sh jobs-image
136 if [[ "$ECODE" != "0" ]]; then
137 EXITCODE=$(($EXITCODE + $ECODE))
140 checkexit $ECODE "docker build"
141 title "docker build complete (`timer`)"
143 title "uploading images"
147 if [[ "$ECODE" != "0" ]]; then
148 title "upload arvados images SKIPPED because build failed"
150 if [[ $upload == true ]]; then
151 ## 20150526 nico -- *sometimes* dockerhub needs re-login
152 ## even though credentials are already in .dockercfg
153 docker login -u arvados
155 docker_push arvados/jobs
156 title "upload arvados images finished (`timer`)"
158 title "upload arvados images SKIPPED because no --upload option set (`timer`)"