Bug 1252235 - Make try syntax available to mozharness from TaskCluster through an environment variable. r=armenzg
authorChris Manchester <cmanchester@mozilla.com>
Mon, 29 Aug 2016 16:33:24 -0700
changeset 314089 fdc068413084b15bc0831482af66d9445dd59246
parent 314088 9d0ff9c806d74810f6f9d118212e2d27177d67eb
child 314090 5555d5ae4ca2e852a5a4f2e90a4bb6f405c79b29
push id81796
push userkwierso@gmail.com
push dateThu, 15 Sep 2016 23:40:35 +0000
treeherdermozilla-inbound@d402fd4afc29 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarmenzg
bugs1252235
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1252235 - Make try syntax available to mozharness from TaskCluster through an environment variable. r=armenzg MozReview-Commit-ID: HIVIXPQXnQs
.taskcluster.yml
taskcluster/taskgraph/transforms/tests/make_task_description.py
testing/mozharness/mozharness/mozilla/testing/try_tools.py
--- a/.taskcluster.yml
+++ b/.taskcluster.yml
@@ -99,17 +99,17 @@ tasks:
           - -cx
           - >
               cd /home/worker/checkouts/gecko &&
               ln -s /home/worker/artifacts artifacts &&
               ./mach --log-no-times taskgraph decision
               --pushlog-id='{{pushlog_id}}'
               --pushdate='{{pushdate}}'
               --project='{{project}}'
-              --message='{{comment}}'
+              --message={{#shellquote}}{{{comment}}}{{/shellquote}}
               --owner='{{owner}}'
               --level='{{level}}'
               --base-repository='https://hg.mozilla.org/mozilla-central'
               --head-repository='{{{url}}}'
               --head-ref='{{revision}}'
               --head-rev='{{revision}}'
               --revision-hash='{{revision_hash}}'
 
--- a/taskcluster/taskgraph/transforms/tests/make_task_description.py
+++ b/taskcluster/taskgraph/transforms/tests/make_task_description.py
@@ -169,16 +169,19 @@ def docker_worker_setup(config, test, ta
     }
 
     if mozharness['set-moz-node-path']:
         env['MOZ_NODE_PATH'] = '/usr/local/bin/node'
 
     if 'actions' in mozharness:
         env['MOZHARNESS_ACTIONS'] = ' '.join(mozharness['actions'])
 
+    if config.params['project'] == 'try':
+        env['TRY_COMMIT_MSG'] = config.params['message']
+
     # handle some of the mozharness-specific options
 
     if mozharness['tooltool-downloads']:
         worker['relengapi-proxy'] = True
         worker['caches'].append({
             'type': 'persistent',
             'name': 'tooltool-cache',
             'mount-point': '/home/worker/tooltool-cache',
--- a/testing/mozharness/mozharness/mozilla/testing/try_tools.py
+++ b/testing/mozharness/mozharness/mozilla/testing/try_tools.py
@@ -73,16 +73,18 @@ class TryToolsMixin(TransferMixin):
             'reftest',
         )),
     }
 
     def _extract_try_message(self):
         msg = None
         if "try_message" in self.config and self.config["try_message"]:
             msg = self.config["try_message"]
+        elif 'TRY_COMMIT_MSG' in os.environ:
+            msg = os.environ['TRY_COMMIT_MSG']
         elif self._is_try():
             if self.buildbot_config['sourcestamp']['changes']:
                 msg = self.buildbot_config['sourcestamp']['changes'][-1]['comments']
 
             if msg is None or len(msg) == 1024:
                 # This commit message was potentially truncated or not available in
                 # buildbot_config (e.g. if running in TaskCluster), get the full message
                 # from hg.
@@ -149,17 +151,18 @@ class TryToolsMixin(TransferMixin):
         msg_list = self._extract_try_args(message)
         args, _ = parser.parse_known_args(msg_list)
         return getattr(args, flag, False)
 
     def _is_try(self):
         repo_path = None
         if self.buildbot_config and 'properties' in self.buildbot_config:
             repo_path = self.buildbot_config['properties'].get('branch')
-        return self.config.get('branch', repo_path) == 'try'
+        return (self.config.get('branch', repo_path) == 'try' or
+                'TRY_COMMIT_MSG' in os.environ)
 
     @PostScriptAction('download-and-extract')
     def set_extra_try_arguments(self, action, success=None):
         """Finds a commit message and parses it for extra arguments to pass to the test
         harness command line and test paths used to filter manifests.
 
         Extracting arguments from a commit message taken directly from the try_parser.
         """