Bug 1318200 - Pass topsrcdir into decision parameters; r?dustin draft
authorGregory Szorc <gps@mozilla.com>
Thu, 17 Nov 2016 17:42:55 -0800
changeset 441328 06242e612265680a1dbc28f47b126146b1be87cc
parent 441327 4e499341a65666cf20149c0dd0d95f1766f6a59f
child 441329 5d0047a01623a8cc5aff209e30d4c5302c31d9af
push id36394
push userbmo:gps@mozilla.com
push dateFri, 18 Nov 2016 18:38:31 +0000
reviewersdustin
bugs1318200
milestone53.0a1
Bug 1318200 - Pass topsrcdir into decision parameters; r?dustin This will allow filters and other code with access to parameters to examine the source checkout. Previously, we passed in "root" via options. But it was only exposed to the TaskGraphGenerator instance and not available in parameters. MozReview-Commit-ID: G2YKmlT0syB
taskcluster/docs/parameters.rst
taskcluster/mach_commands.py
taskcluster/taskgraph/decision.py
taskcluster/taskgraph/parameters.py
--- a/taskcluster/docs/parameters.rst
+++ b/taskcluster/docs/parameters.rst
@@ -64,16 +64,19 @@ Push Information
 
 ``moz_build_date``
    A formatted timestamp of ``build_date``. Expressed as a string with the following
    format: %Y%m%d%H%M%S
 
 Tree Information
 ----------------
 
+``topsrcdir``
+   Path to source checkout. (Should be set automatically.)
+
 ``project``
    Another name for what may otherwise be called tree or branch or
    repository.  This is the unqualified name, such as ``mozilla-central`` or
    ``cedar``.
 
 ``level``
    The `SCM level
    <https://www.mozilla.org/en-US/about/governance/policies/commit/access-policy/>`_
--- a/taskcluster/mach_commands.py
+++ b/taskcluster/mach_commands.py
@@ -155,16 +155,17 @@ class MachCommands(MachCommandBase):
         TaskCluster.  This is only meant to be called within decision tasks,
         and requires a great many arguments.  Commands like `mach taskgraph
         optimized` are better suited to use on the command line, and can take
         the parameters file generated by a decision task.  """
 
         import taskgraph.decision
         try:
             self.setup_logging()
+            options['topsrcdir'] = self.topsrcdir
             return taskgraph.decision.taskgraph_decision(options)
         except Exception:
             traceback.print_exc()
             sys.exit(1)
 
     @SubCommand('taskgraph', 'action-task',
                 description="Run the action task")
     @CommandArgument('--root', '-r',
--- a/taskcluster/taskgraph/decision.py
+++ b/taskcluster/taskgraph/decision.py
@@ -114,16 +114,17 @@ def get_decision_parameters(options):
         'head_rev',
         'head_ref',
         'message',
         'project',
         'pushlog_id',
         'pushdate',
         'owner',
         'level',
+        'topsrcdir',
         'triggered_by',
         'target_tasks_method',
     ] if n in options}
 
     # Define default filter list, as most configurations shouldn't need
     # custom filters.
     parameters['filters'] = [
         'target_tasks_method',
--- a/taskcluster/taskgraph/parameters.py
+++ b/taskcluster/taskgraph/parameters.py
@@ -22,16 +22,17 @@ PARAMETER_NAMES = set([
     'message',
     'moz_build_date',
     'optimize_target_tasks',
     'owner',
     'project',
     'pushdate',
     'pushlog_id',
     'target_tasks_method',
+    'topsrcdir',
     'triggered_by',
 ])
 
 
 class Parameters(ReadOnlyDict):
     """An immutable dictionary with nicer KeyError messages on failure"""
     def check(self):
         names = set(self)