Bug 1318841 - Ensure desktop1604-test docker image downloads the run-wizard binary from vcs, r=jmaher
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 22 Nov 2016 10:57:48 -0500
changeset 323938 59e448d0eba8b55b2927cf8071f6d3beb2c56f5a
parent 323937 25c7f7eb112ccea20e2083a38499ae5f12097480
child 323939 47dddc6dc461c0c8de11b1571424b3dab5216fbc
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersjmaher
bugs1318841
milestone53.0a1
Bug 1318841 - Ensure desktop1604-test docker image downloads the run-wizard binary from vcs, r=jmaher This image currently has a version of the "run-wizard" binary baked in. This is out of date from the canonical copy under taskcluster/scripts. This patch just copies what the "desktop-test" image does by downloading that binary from version control. MozReview-Commit-ID: Eg4x8slf3X9
testing/docker/desktop1604-test/Dockerfile
testing/docker/desktop1604-test/bin/run-wizard
testing/docker/desktop1604-test/taskcluster-interactive-shell
--- a/testing/docker/desktop1604-test/Dockerfile
+++ b/testing/docker/desktop1604-test/Dockerfile
@@ -48,17 +48,16 @@ ENV           USER          worker
 ENV           LOGNAME       worker
 ENV           HOSTNAME      taskcluster-worker
 ENV           LANG          en_US.UTF-8
 ENV           LC_ALL        en_US.UTF-8
 
 # Add utilities and configuration
 COPY           dot-files/config              /home/worker/.config
 COPY           dot-files/pulse               /home/worker/.pulse
-COPY           bin                           /home/worker/bin
 RUN            chmod +x bin/*
 # TODO: remove this when buildbot is gone
 COPY           buildprops.json               /home/worker/buildprops.json
 COPY           tc-vcs-config.yml /etc/taskcluster-vcs.yml
 
 # TODO: remove
 ADD            https://raw.githubusercontent.com/taskcluster/buildbot-step/master/buildbot_step /home/worker/bin/buildbot_step
 RUN chmod u+x /home/worker/bin/buildbot_step
deleted file mode 100755
--- a/testing/docker/desktop1604-test/bin/run-wizard
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/usr/bin/env python
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this,
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-from __future__ import print_function, unicode_literals
-
-import os
-import subprocess
-import sys
-from textwrap import wrap
-
-
-def call(cmd, **kwargs):
-    print(" ".join(cmd))
-    return subprocess.call(cmd, **kwargs)
-
-
-def resume():
-    call(['run-mozharness'])
-
-
-def setup():
-    call(['run-mozharness', '--no-run-tests'])
-    print("Mozharness has finished downloading the build and "
-          "tests to {}.".format(os.path.join(os.getcwd(), 'build')))
-
-
-def clone():
-    repo = os.environ['GECKO_HEAD_REPOSITORY']
-    rev = os.environ['GECKO_HEAD_REV']
-    clone_path = os.path.expanduser(os.path.join('~', 'gecko'))
-
-    # try is too large to clone, instead clone central and pull
-    # in changes from try
-    if "hg.mozilla.org/try" in repo:
-        central = 'http://hg.mozilla.org/mozilla-central'
-        call(['hg', 'clone', '-U', central, clone_path])
-        call(['hg', 'pull', '-u', '-r', rev, repo], cwd=clone_path)
-    else:
-        call(['hg', 'clone', '-u', rev, repo, clone_path])
-    print("Finished cloning to {} at revision {}.".format(
-                clone_path, rev))
-
-
-def exit():
-    pass
-
-
-OPTIONS = [
-    ('Resume task', resume,
-     "Resume the original task without modification. This can be useful for "
-     "passively monitoring it from another shell."),
-    ('Setup task', setup,
-     "Setup the task (download the application and tests) but don't run the "
-     "tests just yet. The tests can be run with a custom configuration later "
-     "(experimental)."),
-    ('Clone gecko', clone,
-     "Perform a clone of gecko using the task's repo and update it to the "
-     "task's revision."),
-    ('Exit', exit, "Exit this wizard and return to the shell.")
-]
-
-
-def _fmt_options():
-    max_line_len = 60
-    max_name_len = max(len(o[0]) for o in OPTIONS)
-
-    # TODO Pad will be off if there are more than 9 options.
-    pad = ' ' * (max_name_len+6)
-
-    msg = []
-    for i, (name, _, desc) in enumerate(OPTIONS):
-        desc = wrap(desc, width=max_line_len)
-        desc = [desc[0]] + [pad + l for l in desc[1:]]
-
-        optstr = '{}) {} - {}\n'.format(
-            i+1, name.ljust(max_name_len), '\n'.join(desc))
-        msg.append(optstr)
-    msg.append("Select one of the above options: ")
-    return '\n'.join(msg)
-
-
-def wizard():
-    print("This wizard can help you get started with some common debugging "
-          "workflows.\nWhat would you like to do?\n")
-    print(_fmt_options(), end="")
-    choice = None
-    while True:
-        choice = raw_input().decode('utf8')
-        try:
-            choice = int(choice)-1
-            if 0 <= choice < len(OPTIONS):
-                break
-        except ValueError:
-            pass
-
-        print("Must provide an integer from 1-{}:".format(len(OPTIONS)))
-
-    func = OPTIONS[choice][1]
-    ret = func()
-
-    print("Use the 'run-wizard' command to start this wizard again.")
-    return ret
-
-
-if __name__ == '__main__':
-    sys.exit(wizard())
--- a/testing/docker/desktop1604-test/taskcluster-interactive-shell
+++ b/testing/docker/desktop1604-test/taskcluster-interactive-shell
@@ -1,10 +1,22 @@
 #!/usr/bin/env bash
-/home/worker/bin/run-wizard;
+
+download() {
+    name=`basename $1`
+    url=${GECKO_HEAD_REPOSITORY}/raw-file/${GECKO_HEAD_REV}/$1
+    if ! curl --fail --silent -o ./$name --retry 10 $url; then
+        fail "failed downloading $1 from ${GECKO_HEAD_REPOSITORY}"
+    fi
+}
+
+cd $HOME/bin;
+download taskcluster/scripts/tester/run-wizard;
+chmod +x run-wizard;
+./run-wizard;
 
 SPAWN="$SHELL";
-
 if [ "$SHELL" = "bash" ]; then
   SPAWN="bash -li";
 fi;
 
+cd $HOME;
 exec $SPAWN;