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 Output debug information (default: false)
16 WORKSPACE=path Path to the Arvados source tree to build packages from
20 if ! [[ -n "$WORKSPACE" ]]; then
21 echo >&2 "$helpmessage"
23 echo >&2 "Error: WORKSPACE environment variable not set"
28 if ! [[ -d "$WORKSPACE" ]]; then
29 echo >&2 "$helpmessage"
31 echo >&2 "Error: $WORKSPACE is not a directory"
38 PARSEDOPTS=$(getopt --name "$0" --longoptions \
48 eval set -- "$PARSEDOPTS"
49 while [ $# -gt 0 ]; do
52 echo >&2 "$helpmessage"
64 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
72 if [[ "$COMMAND" != "" ]]; then
73 COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND$DEBUG"
77 JENKINS_DIR=$(dirname "$(readlink -e "$0")")
81 if [[ "$COMMAND" != "" ]]; then
82 COMMAND="$COMMAND --target $tag"
84 if docker run -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
85 --env ARVADOS_DEBUG=1 "arvados/build:$tag" $COMMAND; then
86 # Success - nothing more to do.
90 echo "ERROR: $tag build failed with exit status $FINAL_EXITCODE." >&2
94 # In case it's needed, build the containers. This costs just a few
95 # seconds when the containers already exist, so it's not a big deal to
97 cd "$JENKINS_DIR/dockerfiles"
98 time ./build-all-build-containers.sh
100 for dockerfile_path in $(find -name Dockerfile); do
101 run_docker "$(basename $(dirname "$dockerfile_path"))"