Bug 1415868 - add 'mach taskgraph actions'; r=jonasfj,tomprince
MozReview-Commit-ID: ExVRgcD02GK
This commit is contained in:
@@ -34,6 +34,11 @@ a custom action task can be more efficient.
|
||||
|
||||
Creating a Callback Action
|
||||
--------------------------
|
||||
|
||||
.. note:
|
||||
|
||||
You can generate ``actions.json`` on the command line with ``./mach taskgraph actions``.
|
||||
|
||||
A *callback action* is an action that calls back into in-tree logic. That is,
|
||||
you register the action with name, title, description, context, input schema and a
|
||||
python callback. When the action is triggered in a user interface,
|
||||
|
||||
@@ -103,6 +103,20 @@ class MachCommands(MachCommandBase):
|
||||
def taskgraph_morphed(self, **options):
|
||||
return self.show_taskgraph('morphed_task_graph', options)
|
||||
|
||||
@SubCommand('taskgraph', 'actions',
|
||||
description="Write actions.json to stdout")
|
||||
@CommandArgument('--root', '-r',
|
||||
help="root of the taskgraph definition relative to topsrcdir")
|
||||
@CommandArgument('--quiet', '-q', action="store_true",
|
||||
help="suppress all logging output")
|
||||
@CommandArgument('--verbose', '-v', action="store_true",
|
||||
help="include debug-level logging output")
|
||||
@CommandArgument('--parameters', '-p', default="project=mozilla-central",
|
||||
help="parameters file (.yml or .json; see "
|
||||
"`taskcluster/docs/parameters.rst`)`")
|
||||
def taskgraph_actions(self, **options):
|
||||
return self.show_actions(options)
|
||||
|
||||
@SubCommand('taskgraph', 'decision',
|
||||
description="Run the decision task")
|
||||
@CommandArgument('--root', '-r',
|
||||
@@ -385,6 +399,28 @@ class MachCommands(MachCommandBase):
|
||||
filtered_taskgraph = TaskGraph(filteredtasks, Graph(set(filteredtasks), filterededges))
|
||||
return filtered_taskgraph
|
||||
|
||||
def show_actions(self, options):
|
||||
import taskgraph.parameters
|
||||
import taskgraph.target_tasks
|
||||
import taskgraph.generator
|
||||
import taskgraph
|
||||
import taskgraph.actions
|
||||
|
||||
try:
|
||||
self.setup_logging(quiet=options['quiet'], verbose=options['verbose'])
|
||||
parameters = taskgraph.parameters.load_parameters_file(options['parameters'])
|
||||
parameters.check()
|
||||
|
||||
tgg = taskgraph.generator.TaskGraphGenerator(
|
||||
root_dir=options.get('root'),
|
||||
parameters=parameters)
|
||||
|
||||
actions = taskgraph.actions.render_actions_json(parameters, tgg.graph_config)
|
||||
print(json.dumps(actions, sort_keys=True, indent=2, separators=(',', ': ')))
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@CommandProvider
|
||||
class TaskClusterImagesProvider(MachCommandBase):
|
||||
|
||||
Reference in New Issue
Block a user