Optimization: do not run bundle install for the API server package when
[arvados-dev.git] / jenkins / run-build-packages-all-targets.sh
1 #!/bin/bash
2
3 read -rd "\000" helpmessage <<EOF
4 $(basename $0): Orchestrate run-build-packages.sh for every target
5
6 Syntax:
7         WORKSPACE=/path/to/arvados $(basename $0)
8
9 WORKSPACE=path         Path to the Arvados source tree to build packages from
10
11 EOF
12
13 if ! [[ -n "$WORKSPACE" ]]; then
14   echo >&2 "$helpmessage"
15   echo >&2
16   echo >&2 "Error: WORKSPACE environment variable not set"
17   echo >&2
18   exit 1
19 fi
20
21 set -e
22
23 FINAL_EXITCODE=0
24 JENKINS_DIR=$(dirname "$(readlink -e "$0")")
25
26 run_docker() {
27     local tag=$1; shift
28     if docker run -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
29           --env ARVADOS_DEBUG=1 "arvados/build:$tag"; then
30         # Success - nothing more to do.
31         true
32     else
33         FINAL_EXITCODE=$?
34         echo "ERROR: $tag build failed with exit status $FINAL_EXITCODE." >&2
35     fi
36 }
37
38 # In case it's needed, build the containers. This costs just a few
39 # seconds when the containers already exist, so it's not a big deal to
40 # do it on each run.
41 cd "$JENKINS_DIR/dockerfiles"
42 time ./build-all-build-containers.sh
43
44 for dockerfile_path in $(find -name Dockerfile); do
45     run_docker "$(basename $(dirname "$dockerfile_path"))"
46 done
47
48 exit $FINAL_EXITCODE