3 read -rd "\000" helpmessage <<EOF
4 $(basename $0): Orchestrate run-build-packages.sh for every target
7 WORKSPACE=/path/to/arvados $(basename $0) [options]
12 Build command to execute (default: use built-in Docker image command)
14 WORKSPACE=path Path to the Arvados source tree to build packages from
18 if ! [[ -n "$WORKSPACE" ]]; then
19 echo >&2 "$helpmessage"
21 echo >&2 "Error: WORKSPACE environment variable not set"
26 if ! [[ -d "$WORKSPACE" ]]; then
27 echo >&2 "$helpmessage"
29 echo >&2 "Error: $WORKSPACE is not a directory"
36 PARSEDOPTS=$(getopt --name "$0" --longoptions \
45 eval set -- "$PARSEDOPTS"
46 while [ $# -gt 0 ]; do
49 echo >&2 "$helpmessage"
58 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
66 if [[ "$COMMAND" != "" ]]; then
67 COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND"
71 JENKINS_DIR=$(dirname "$(readlink -e "$0")")
75 if [[ "$COMMAND" != "" ]]; then
76 COMMAND="$COMMAND --target $tag"
78 if docker run -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
79 --env ARVADOS_DEBUG=1 "arvados/build:$tag" $COMMAND; then
80 # Success - nothing more to do.
84 echo "ERROR: $tag build failed with exit status $FINAL_EXITCODE." >&2
88 # In case it's needed, build the containers. This costs just a few
89 # seconds when the containers already exist, so it's not a big deal to
91 cd "$JENKINS_DIR/dockerfiles"
92 time ./build-all-build-containers.sh
94 for dockerfile_path in $(find -name Dockerfile); do
95 run_docker "$(basename $(dirname "$dockerfile_path"))"