6682: Add script to orchestrate builds for multiple targets.
authorBrett Smith <brett@curoverse.com>
Thu, 23 Jul 2015 02:21:59 +0000 (22:21 -0400)
committerBrett Smith <brett@curoverse.com>
Fri, 24 Jul 2015 16:07:32 +0000 (12:07 -0400)
Now that we can build packages for multiple targets, it's nice to have
a one-shot script to build them all.  This does that.

jenkins/run-build-packages-all-targets.sh [new file with mode: 0755]
jenkins/run-build-packages.sh

diff --git a/jenkins/run-build-packages-all-targets.sh b/jenkins/run-build-packages-all-targets.sh
new file mode 100755 (executable)
index 0000000..a1052a9
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# Orchestrate run-build-packages.sh for every target.
+
+set -e
+
+FINAL_EXITCODE=0
+JENKINS_DIR=$(dirname "$(readlink -e "$0")")
+
+run_docker() {
+    local tag=$1; shift
+    if docker run -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
+          --env ARVADOS_DEBUG=1 "arvados/build:$tag"; then
+        # Success - nothing more to do.
+        true
+    else
+        FINAL_EXITCODE=$?
+        echo "ERROR: $tag build failed with exit status $FINAL_EXITCODE." >&2
+    fi
+}
+
+# In case it's needed, build the containers. This costs just a few
+# seconds when the containers already exist, so it's not a big deal to
+# do it on each run.
+cd "$JENKINS_DIR/dockerfiles"
+time ./build-all-build-containers.sh
+
+for dockerfile_path in $(find -name Dockerfile); do
+    run_docker "$(basename $(dirname "$dockerfile_path"))"
+done
+
+exit $FINAL_EXITCODE
index fc12cb403168b77c5cf4eb6e6115a895af74fa3a..b8e58d731b09fb9512cac36d79a94cb2a24f5342 100755 (executable)
@@ -21,7 +21,7 @@ WORKSPACE=path         Path to the Arvados source tree to build packages from
 EOF
 
 EXITCODE=0
-DEBUG=0
+DEBUG=${ARVADOS_DEBUG:-0}
 BUILD_BUNDLE_PACKAGES=0
 TARGET=debian7