Bug 1252235 - Make try syntax available to mozharness from TaskCluster through an environment variable. r=armenzg
MozReview-Commit-ID: HIVIXPQXnQs
--- 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
@@ -168,16 +168,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.
"""