2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
8 echo >&2 "usage: $0 [options]"
10 echo >&2 "$0 options:"
11 echo >&2 " -t, --tags [csv_tags] comma separated tags"
12 echo >&2 " -u, --upload Upload the images (docker push)"
13 echo >&2 " -h, --help Display this help and exit"
15 echo >&2 " If no options are given, just builds the images."
20 # NOTE: This requires GNU getopt (part of the util-linux package on Debian-based distros).
21 TEMP=`getopt -o hut: \
22 --long help,upload,tags: \
25 if [ $? != 0 ] ; then echo "Use -h for help"; exit 1 ; fi
26 # Note the quotes around `$TEMP': they are essential!
39 echo "ERROR: --tags needs a parameter";
66 printf "\n%*s\n\n" $(((${#title}+$COLUMNS)/2)) "********** $1 **********"
72 for tag in $( echo $tags|tr "," " " )
74 $DOCKER tag $1 $1:$tag
78 # Sometimes docker push fails; retry it a few times if necessary.
79 for i in `seq 1 5`; do
82 if [[ "$ECODE" == "0" ]]; then
87 if [[ "$ECODE" != "0" ]]; then
88 title "!!!!!! docker push $* failed !!!!!!"
89 EXITCODE=$(($EXITCODE + $ECODE))
98 echo -n "$(($SECONDS - $t0))s"
102 if ! [[ -n "$WORKSPACE" ]]; then
104 echo >&2 "Error: WORKSPACE environment variable not set"
111 # find the docker binary
112 DOCKER=`which docker.io`
114 if [[ "$DOCKER" == "" ]]; then
115 DOCKER=`which docker`
118 if [[ "$DOCKER" == "" ]]; then
119 title "Error: you need to have docker installed. Could not find the docker executable."
124 title "Starting docker build"
128 # clean up the docker build environment
131 title "Starting arvbox build localdemo"
133 tools/arvbox/bin/arvbox build localdemo
136 if [[ "$ECODE" != "0" ]]; then
137 title "!!!!!! docker BUILD FAILED !!!!!!"
138 EXITCODE=$(($EXITCODE + $ECODE))
141 title "Starting arvbox build dev"
143 tools/arvbox/bin/arvbox build dev
147 if [[ "$ECODE" != "0" ]]; then
148 title "!!!!!! docker BUILD FAILED !!!!!!"
149 EXITCODE=$(($EXITCODE + $ECODE))
152 title "docker build complete (`timer`)"
154 title "uploading images"
158 if [[ "$EXITCODE" != "0" ]]; then
159 title "upload arvados images SKIPPED because build failed"
161 if [[ $upload == true ]]; then
162 ## 20150526 nico -- *sometimes* dockerhub needs re-login
163 ## even though credentials are already in .dockercfg
164 docker login -u arvados
166 docker_push arvados/arvbox-dev
167 docker_push arvados/arvbox-demo
168 title "upload arvados images complete (`timer`)"
170 title "upload arvados images SKIPPED because no --upload option set"