Bug 1294234 - Add test-ubuntu*.sh scripts to Docker image; r?dustin draft
authorGregory Szorc <gps@mozilla.com>
Tue, 09 Aug 2016 13:12:14 -0700
changeset 400207 418f11ada7aaf16f3a4c3522f014b42690d44295
parent 400206 cba8b13ae845dfaf41a718ba8e60061b8bcffccd
child 400208 52605d7091c73fc47da753bbb298b242f7a3a2ae
push id26089
push userbmo:gps@mozilla.com
push dateFri, 12 Aug 2016 18:27:50 +0000
reviewersdustin
bugs1294234
milestone51.0a1
Bug 1294234 - Add test-ubuntu*.sh scripts to Docker image; r?dustin Before, we `curl`d these files at task run time. Why, I'm not sure. Probably the easiest way to do things before we could add files outside the directory of the Dockerfile to the image build context. Since that is no longer a restriction, we just include the file as part of the built image. This does mean we rebuild the Docker image if the scripts change. I'm fine with that. It's worth noting that both test.sh files look very similar. I anticipate consolidation in the future... MozReview-Commit-ID: 48dinmxy6G0
testing/docker/desktop-test/Dockerfile
testing/docker/desktop-test/bin/test.sh
testing/docker/desktop1604-test/Dockerfile
testing/docker/desktop1604-test/bin/test.sh
--- a/testing/docker/desktop-test/Dockerfile
+++ b/testing/docker/desktop-test/Dockerfile
@@ -12,16 +12,19 @@ ADD topsrcdir/testing/docker/recipes/ins
 
 # %include testing/docker/recipes/ubuntu1204-test-system-setup.sh
 ADD topsrcdir/testing/docker/recipes/ubuntu1204-test-system-setup.sh /setup/system-setup.sh
 RUN bash /setup/system-setup.sh
 
 # %include testing/docker/recipes/run-task
 ADD topsrcdir/testing/docker/recipes/run-task /home/worker/bin/run-task
 
+# %include taskcluster/scripts/tester/test-ubuntu1204.sh
+ADD topsrcdir/taskcluster/scripts/tester/test-ubuntu1204.sh /home/worker/bin/test-linux.sh
+
 # This will create a host mounted filesystem when the cache is stripped
 # on Try. This cancels out some of the performance losses of aufs. See
 # bug 1291940.
 VOLUME /home/worker/workspace
 
 # Set variable normally configured at login, by the shells parent process, these
 # are taken from GNU su manual
 ENV           HOME          /home/worker
--- a/testing/docker/desktop-test/bin/test.sh
+++ b/testing/docker/desktop-test/bin/test.sh
@@ -10,29 +10,11 @@ set -x -e
 # TODO: when bug 1093833 is solved and tasks can run as non-root, reduce this
 # to a simple fail-if-root check
 if [ $(id -u) = 0 ]; then
     chown -R worker:worker /home/worker
     # drop privileges by re-running this script
     exec sudo -E -u worker bash /home/worker/bin/test.sh "${@}"
 fi
 
-fail() {
-    echo # make sure error message is on a new line
-    echo "[test.sh:error]" "${@}"
-    exit 1
-}
-
-####
-# Now get the test-linux.sh script from the given Gecko tree and run it with
-# the same arguments.
-####
-
 [ -d $WORKSPACE ] || mkdir -p $WORKSPACE
 cd $WORKSPACE
-
-script=taskcluster/scripts/tester/test-ubuntu1204.sh
-url=${GECKO_HEAD_REPOSITORY}/raw-file/${GECKO_HEAD_REV}/${script}
-if ! curl --fail -o ./test-linux.sh --retry 10 $url; then
-    fail "failed downloading test-linux.sh from ${GECKO_HEAD_REPOSITORY}"
-fi
-chmod +x ./test-linux.sh
-exec ./test-linux.sh "${@}"
+exec /home/worker/bin/test-linux.sh "${@}"
--- a/testing/docker/desktop1604-test/Dockerfile
+++ b/testing/docker/desktop1604-test/Dockerfile
@@ -12,16 +12,19 @@ ADD topsrcdir/testing/docker/recipes/ins
 
 # %include testing/docker/recipes/ubuntu1604-test-system-setup.sh
 ADD topsrcdir/testing/docker/recipes/ubuntu1604-test-system-setup.sh /setup/system-setup.sh
 RUN           bash /setup/system-setup.sh
 
 # %include testing/docker/recipes/run-task
 ADD topsrcdir/testing/docker/recipes/run-task /home/worker/bin/run-task
 
+# %include taskcluster/scripts/tester/test-ubuntu1604.sh
+ADD topsrcdir/taskcluster/scripts/tester/test-ubuntu1604.sh /home/worker/bin/test-linux.sh
+
 # This will create a host mounted filesystem when the cache is stripped
 # on Try. This cancels out some of the performance losses of aufs. See
 # bug 1291940.
 VOLUME /home/worker/workspace
 
 # Set variable normally configured at login, by the shells parent process, these
 # are taken from GNU su manual
 ENV           HOME          /home/worker
--- a/testing/docker/desktop1604-test/bin/test.sh
+++ b/testing/docker/desktop1604-test/bin/test.sh
@@ -10,29 +10,11 @@ set -x -e
 # TODO: when bug 1093833 is solved and tasks can run as non-root, reduce this
 # to a simple fail-if-root check
 if [ $(id -u) = 0 ]; then
     chown -R worker:worker /home/worker
     # drop privileges by re-running this script
     exec sudo -E -u worker bash /home/worker/bin/test.sh "${@}"
 fi
 
-fail() {
-    echo # make sure error message is on a new line
-    echo "[test.sh:error]" "${@}"
-    exit 1
-}
-
-####
-# Now get the test-linux.sh/test-ubuntu.sh script from the given Gecko tree
-# and run it with the same arguments.
-####
-
 [ -d $WORKSPACE ] || mkdir -p $WORKSPACE
 cd $WORKSPACE
-
-script=taskcluster/scripts/tester/test-ubuntu1604.sh
-url=${GECKO_HEAD_REPOSITORY}/raw-file/${GECKO_HEAD_REV}/${script}
-if ! curl --fail -o ./test-linux.sh --retry 10 $url; then
-    fail "failed downloading test-ubuntu1604.sh from ${GECKO_HEAD_REPOSITORY}"
-fi
-chmod +x ./test-linux.sh
-exec ./test-linux.sh "${@}"
+exec /home/worker/bin/test-linux.sh "${@}"