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]
9 WORKSPACE=path Path to the Arvados source tree to build packages from
12 Build command to execute (default: use built-in Docker image command)
16 if ! [[ -n "$WORKSPACE" ]]; then
17 echo >&2 "$helpmessage"
19 echo >&2 "Error: WORKSPACE environment variable not set"
24 if ! [[ -d "$WORKSPACE" ]]; then
25 echo >&2 "$helpmessage"
27 echo >&2 "Error: $WORKSPACE is not a directory"
34 PARSEDOPTS=$(getopt --name "$0" --longoptions \
43 eval set -- "$PARSEDOPTS"
44 while [ $# -gt 0 ]; do
47 echo >&2 "$helpmessage"
56 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
64 if [[ "$COMMAND" != "" ]]; then
65 COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND"
69 JENKINS_DIR=$(dirname "$(readlink -e "$0")")
73 if [[ "$COMMAND" != "" ]]; then
74 COMMAND="$COMMAND --target $tag"
76 if docker run -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
77 --env ARVADOS_DEBUG=1 "arvados/build:$tag" $COMMAND; then
78 # Success - nothing more to do.
82 echo "ERROR: $tag build failed with exit status $FINAL_EXITCODE." >&2
86 # In case it's needed, build the containers. This costs just a few
87 # seconds when the containers already exist, so it's not a big deal to
89 cd "$JENKINS_DIR/dockerfiles"
90 time ./build-all-build-containers.sh
92 for dockerfile_path in $(find -name Dockerfile); do
93 run_docker "$(basename $(dirname "$dockerfile_path"))"