зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1641971: [taskgraph] Pass explicit decision task id to action.json generation; r=Callek
Differential Revision: https://phabricator.services.mozilla.com/D77550
This commit is contained in:
Родитель
86711ecee8
Коммит
9f3450be95
|
@ -437,7 +437,9 @@ class MachCommands(MachCommandBase):
|
|||
parameters=parameters,
|
||||
)
|
||||
|
||||
actions = taskgraph.actions.render_actions_json(tgg.parameters, tgg.graph_config)
|
||||
actions = taskgraph.actions.render_actions_json(
|
||||
tgg.parameters, tgg.graph_config, decision_task_id="DECISION-TASK",
|
||||
)
|
||||
print(json.dumps(actions, sort_keys=True, indent=2, separators=(',', ': ')))
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
from slugid import nice as slugid
|
||||
from types import FunctionType
|
||||
from collections import namedtuple
|
||||
|
||||
|
@ -153,7 +151,7 @@ def register_callback_action(name, title, symbol, description, order=10000,
|
|||
cb_name = name
|
||||
assert cb_name not in callbacks, 'callback name {} is not unique'.format(cb_name)
|
||||
|
||||
def action_builder(parameters, graph_config):
|
||||
def action_builder(parameters, graph_config, decision_task_id):
|
||||
if not available(parameters):
|
||||
return None
|
||||
|
||||
|
@ -174,7 +172,6 @@ def register_callback_action(name, title, symbol, description, order=10000,
|
|||
'revision': revision,
|
||||
}
|
||||
|
||||
task_group_id = os.environ.get('TASK_ID', slugid())
|
||||
match = re.match(r'https://(hg.mozilla.org)/(.*?)/?$', parameters[repo_param])
|
||||
if not match:
|
||||
raise Exception('Unrecognized {}'.format(repo_param))
|
||||
|
@ -183,7 +180,7 @@ def register_callback_action(name, title, symbol, description, order=10000,
|
|||
'title': title,
|
||||
'description': description,
|
||||
# target taskGroupId (the task group this decision task is creating)
|
||||
'taskGroupId': task_group_id,
|
||||
'taskGroupId': decision_task_id,
|
||||
'cb_name': cb_name,
|
||||
'symbol': symbol,
|
||||
}
|
||||
|
@ -243,7 +240,7 @@ def register_callback_action(name, title, symbol, description, order=10000,
|
|||
return register_callback
|
||||
|
||||
|
||||
def render_actions_json(parameters, graph_config):
|
||||
def render_actions_json(parameters, graph_config, decision_task_id):
|
||||
"""
|
||||
Render JSON object for the ``public/actions.json`` artifact.
|
||||
|
||||
|
@ -260,7 +257,7 @@ def render_actions_json(parameters, graph_config):
|
|||
assert isinstance(parameters, Parameters), 'requires instance of Parameters'
|
||||
actions = []
|
||||
for action in sorted(_get_actions(graph_config), key=lambda action: action.order):
|
||||
action = action.action_builder(parameters, graph_config)
|
||||
action = action.action_builder(parameters, graph_config, decision_task_id)
|
||||
if action:
|
||||
assert is_json(action), 'action must be a JSON compatible object'
|
||||
actions.append(action)
|
||||
|
|
|
@ -225,7 +225,10 @@ def taskgraph_decision(options, parameters=None):
|
|||
write_artifact('parameters.yml', dict(**tgg.parameters))
|
||||
|
||||
# write out the public/actions.json file
|
||||
write_artifact('actions.json', render_actions_json(tgg.parameters, tgg.graph_config))
|
||||
write_artifact(
|
||||
'actions.json',
|
||||
render_actions_json(tgg.parameters, tgg.graph_config, decision_task_id),
|
||||
)
|
||||
|
||||
# write out the full graph for reference
|
||||
full_task_json = tgg.full_task_graph.to_json()
|
||||
|
|
Загрузка…
Ссылка в новой задаче