Bug 1191584 - Get the full commit message from a try push in mozharness via pushlog to avoid truncations. r=jlund

This commit is contained in:
Chris Manchester 2015-08-06 17:53:55 -07:00
parent ab841833ea
commit c2855da232
2 changed files with 33 additions and 10 deletions

View File

@ -481,12 +481,7 @@ You can set this by:
try_config_path = os.path.join(test_install_dir, 'config', 'mozharness',
'try_arguments.py')
known_try_arguments = parse_config_file(try_config_path)
comments = self.buildbot_config['sourcestamp']['changes'][-1]['comments']
if not comments and 'try_syntax' in self.buildbot_config['properties']:
# If we don't find try syntax in the usual place, check for it in an
# alternate property available to tools using self-serve.
comments = self.buildbot_config['properties']['try_syntax']
self.parse_extra_try_arguments(comments, known_try_arguments)
self.set_extra_try_arguments(known_try_arguments)
self.tree_config.lock()

View File

@ -9,20 +9,48 @@ import argparse
import os
import re
from mozharness.base.transfer import TransferMixin
class TryToolsMixin(object):
class TryToolsMixin(TransferMixin):
"""Utility functions for an interface between try syntax and out test harnesses.
Requires log and script mixins."""
harness_extra_args = None
try_test_paths = []
def parse_extra_try_arguments(self, msg, known_try_arguments):
"""Given a commit message, parse to extract additional arguments to pass
on to the test harness command line.
def _extract_try_message(self):
msg = self.buildbot_config['sourcestamp']['changes'][-1]['comments']
if len(msg) == 1024:
# This commit message was potentially truncated, get the full message
# from hg.
props = self.buildbot_config['properties']
rev = props['revision']
repo = props['repo_path']
url = 'https://hg.mozilla.org/%s/json-pushes?changeset=%s&full=1' % (repo, rev)
pushinfo = self.load_json_from_url(url)
for k, v in pushinfo.items():
if isinstance(v, dict) and 'changesets' in v:
msg = v['changesets'][-1]['desc']
if not msg and 'try_syntax' in self.buildbot_config['properties']:
# If we don't find try syntax in the usual place, check for it in an
# alternate property available to tools using self-serve.
msg = self.buildbot_config['properties']['try_syntax']
return msg
def set_extra_try_arguments(self, known_try_arguments):
"""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.
"""
msg = self._extract_try_message()
if not msg:
return
all_try_args = None
for line in msg.splitlines():
if 'try: ' in line: