Bug 1370907: Pass the try command line to BBB. r=catlee,dustin
In other to support mozharness options for try, we need to add the try
command line argument to buildbot properties.
Note: it depends on [1]
[1]
https://github.com/catlee/buildbot-bridge/commit/9a669dda4ac7d463e2723e25b313ae3abb8dc27b
MozReview-Commit-ID: 7mCnXb24nPb
--- a/taskcluster/taskgraph/transforms/job/mozharness.py
+++ b/taskcluster/taskgraph/transforms/job/mozharness.py
@@ -5,16 +5,17 @@
Support for running jobs via mozharness. Ideally, most stuff gets run this
way, and certainly anything using mozharness should use this approach.
"""
from __future__ import absolute_import, print_function, unicode_literals
import slugid
+import time
from textwrap import dedent
from taskgraph.util.schema import Schema
from voluptuous import Required, Optional, Any
from taskgraph.transforms.job import run_job_using
from taskgraph.transforms.job.common import (
@@ -304,29 +305,39 @@ def mozharness_on_generic_worker(config,
@run_job_using('buildbot-bridge', 'mozharness', schema=mozharness_run_schema)
def mozharness_on_buildbot_bridge(config, job, taskdesc):
run = job['run']
worker = taskdesc['worker']
branch = config.params['project']
product = run.get('index', {}).get('product', 'firefox')
+ params = config.params
worker.pop('env', None)
if 'devedition' in job['attributes']['build_platform']:
buildername = 'OS X 10.7 {} devedition build'.format(branch)
else:
buildername = 'OS X 10.7 {} build'.format(branch)
worker.update({
'buildername': buildername,
'sourcestamp': {
'branch': branch,
- 'repository': config.params['head_repository'],
- 'revision': config.params['head_rev'],
+ 'repository': params['head_repository'],
+ 'revision': params['head_rev'],
+ 'changes': [{
+ 'comments': params['message'],
+ 'author': params['owner'],
+ 'is_dir': 0,
+ 'branch': params['project'],
+ 'revision': params['head_rev'],
+ 'revlink': '{}/rev/{}'.format(params['head_repository'], params['head_rev']),
+ 'when_timestamp': int(time.time()),
+ }],
},
'properties': {
'product': product,
'who': config.params['owner'],
'upload_to_task_id': slugid.nice(),
}
})
--- a/taskcluster/taskgraph/transforms/job/mozharness_test.py
+++ b/taskcluster/taskgraph/transforms/job/mozharness_test.py
@@ -1,13 +1,14 @@
# 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 absolute_import, print_function, unicode_literals
+import time
from voluptuous import Required
from taskgraph.util.taskcluster import get_artifact_url
from taskgraph.transforms.job import run_job_using
from taskgraph.util.schema import Schema
from taskgraph.transforms.tests import (
test_description_schema,
normpath
@@ -512,22 +513,32 @@ def mozharness_test_buildbot_bridge(conf
else:
buildername = '{prefix} {branch} {build_type} test {test_name}'.format(
prefix=prefix,
branch=branch,
build_type=build_type,
test_name=test_name
)
+ params = config.params
worker.update({
'buildername': buildername,
'sourcestamp': {
'branch': branch,
'repository': config.params['head_repository'],
'revision': config.params['head_rev'],
+ 'changes': [{
+ 'comments': config.params['message'],
+ 'author': params['owner'],
+ 'is_dir': 0,
+ 'branch': params['project'],
+ 'revision': params['head_rev'],
+ 'revlink': '{}/rev/{}'.format(params['head_repository'], params['head_rev']),
+ 'when_timestamp': int(time.time()),
+ }],
},
'properties': {
'product': test.get('product', 'firefox'),
'who': config.params['owner'],
'installer_path': mozharness['build-artifact-name'],
}
})
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -417,16 +417,17 @@ task_description_schema = Schema({
# see
# https://github.com/mozilla/buildbot-bridge/blob/master/bbb/schemas/payload.yml
Required('buildername'): basestring,
Required('sourcestamp'): {
'branch': basestring,
Optional('revision'): basestring,
Optional('repository'): basestring,
Optional('project'): basestring,
+ Optional('changes'): list,
},
Required('properties'): {
'product': basestring,
Optional('build_number'): int,
Optional('release_promotion'): bool,
Optional('tuxedo_server_url'): optionally_keyed_by('project', basestring),
Extra: taskref_or_string, # additional properties are allowed
},
--- a/taskcluster/taskgraph/try_option_syntax.py
+++ b/taskcluster/taskgraph/try_option_syntax.py
@@ -180,20 +180,23 @@ def escape_whitespace_in_brackets(input_
result += char
return result
def split_try_msg(message):
try:
+ message, _, mh_options = message.partition('mozharness:')
try_idx = message.index('try:')
except ValueError:
return []
- message = message[try_idx:].split('\n')[0]
+ # in-tree command line parser doesn't need mozharness: keyword,
+ # but it is necessary if we are running buildbot-bridge
+ message = message[try_idx:].split('\n')[0] + mh_options
# shlex used to ensure we split correctly when giving values to argparse.
return shlex.split(escape_whitespace_in_brackets(message))
def parse_message(message):
parts = split_try_msg(message)
# Argument parser based on try flag flags