Bug 1133074 - Use routes.json for Taskcluster routes; r=garndt

This commit is contained in:
Mike Shal 2015-07-27 15:31:23 -04:00
Родитель 51c93c7eea
Коммит e7f67b1781
2 изменённых файлов: 34 добавлений и 4 удалений

Просмотреть файл

@ -112,6 +112,26 @@ def decorate_task_treeherder_routes(task, suffix):
for env in treeheder_env:
task['routes'].append('{}.{}'.format(TREEHERDER_ROUTES[env], suffix))
def decorate_task_json_routes(build, task, json_routes, parameters):
"""
Decorate the given task with routes.json routes.
:param dict task: task definition.
:param json_routes: the list of routes to use from routes.json
:param parameters: dictionary of parameters to use in route templates
"""
fmt = parameters.copy()
fmt.update({
'build_product': task['extra']['build_product'],
'build_name': build['build_name'],
'build_type': build['build_type'],
})
routes = task.get('routes', [])
for route in json_routes:
routes.append(route.format(**fmt))
task['routes'] = routes
def configure_dependent_task(task_path, parameters, taskid, templates, build_treeherder_config):
"""
Configure a build dependent task. This is shared between post-build and test tasks.
@ -267,6 +287,7 @@ class Graph(object):
# Template parameters used when expanding the graph
parameters = dict(gaia_info().items() + {
'index': 'index.garbage.staging.mshal-testing', #TODO
'project': project,
'pushlog_id': params.get('pushlog_id', 0),
'docker_image': docker_image,
@ -289,6 +310,12 @@ class Graph(object):
params.get('revision_hash', '')
)
routes_file = os.path.join(ROOT, 'routes.json')
with open(routes_file) as f:
contents = json.load(f)
json_routes = contents['routes']
# TODO: Nightly and/or l10n routes
# Task graph we are generating for taskcluster...
graph = {
'tasks': [],
@ -312,12 +339,13 @@ class Graph(object):
build_parameters['build_slugid'] = slugid()
build_task = templates.load(build['task'], build_parameters)
if 'routes' not in build_task['task']:
build_task['task']['routes'] = []
if params['revision_hash']:
decorate_task_treeherder_routes(build_task['task'],
treeherder_route)
decorate_task_json_routes(build,
build_task['task'],
json_routes,
build_parameters)
# Ensure each build graph is valid after construction.
taskcluster_graph.build_task.validate(build_task)

Просмотреть файл

@ -275,7 +275,9 @@ def parse_commit(message, jobs):
'dependents': extract_tests_from_platform(
jobs['tests'], platform_builds, build_task, tests
),
'additional-parameters': additional_parameters
'additional-parameters': additional_parameters,
'build_name': platform,
'build_type': build_type,
})
return result