Bug 1294234 - Add test-ubuntu*.sh scripts to Docker image; r=dustin
authorGregory Szorc <gps@mozilla.com>
Tue, 09 Aug 2016 13:12:14 -0700
changeset 400423 527ab73d66dcba30fe0ed4d04aad31142b60a037
parent 400422 a536501b52e2aa3a85b4e32c82f2408c68545c42
child 400424 c72df0f64a7f221f67205aba1d6321f4365ccf5a
push id26138
push usergszorc@mozilla.com
push dateSat, 13 Aug 2016 03:04:36 +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 "${@}"