Bug 1421002: Add an option to control where to find the try_task_config. draft
authorTom Prince <mozilla@hocat.ca>
Tue, 21 Nov 2017 11:26:56 -0700
changeset 703791 6a84665a5d9a0ccdc5603094e674406a880ca191
parent 703782 a3fc6b86e9b0eebd78b5567423eeac49c68ea8f3
child 703792 98d6313ac325d528e6606a67452ef828aa876fa5
child 703805 1ce5a1dc0666b1de0acbf988289ead14b263da04
push id90975
push userbmo:mozilla@hocat.ca
push dateMon, 27 Nov 2017 19:40:40 +0000
bugs1421002
milestone59.0a1
Bug 1421002: Add an option to control where to find the try_task_config. MozReview-Commit-ID: ntC1fJOidr
taskcluster/mach_commands.py
taskcluster/taskgraph/decision.py
--- a/taskcluster/mach_commands.py
+++ b/taskcluster/mach_commands.py
@@ -147,16 +147,18 @@ class MachCommands(MachCommandBase):
     @CommandArgument('--owner',
                      required=True,
                      help='email address of who owns this graph')
     @CommandArgument('--level',
                      required=True,
                      help='SCM level of this repository')
     @CommandArgument('--target-tasks-method',
                      help='method for selecting the target tasks to generate')
+    @CommandArgument('--try-task-config-file',
+                     help='path to try task configuration file')
     def taskgraph_decision(self, **options):
         """Run the decision task: generate a task graph and submit to
         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
--- a/taskcluster/taskgraph/decision.py
+++ b/taskcluster/taskgraph/decision.py
@@ -198,23 +198,27 @@ def get_decision_parameters(options):
 
     # If the target method is nightly, we should build partials. This means
     # knowing what has been released previously.
     # An empty release_history is fine, it just means no partials will be built
     parameters.setdefault('release_history', dict())
     if 'nightly' in parameters.get('target_tasks_method', ''):
         parameters['release_history'] = populate_release_history('Firefox', project)
 
-    # if try_task_config.json is present, load it
-    task_config_file = os.path.join(os.getcwd(), 'try_task_config.json')
+    if options.get('try_task_config_file'):
+        task_config_file = os.path.abspath(options.get('try_task_config_file'))
+    else:
+        # if try_task_config.json is present, load it
+        task_config_file = os.path.join(os.getcwd(), 'try_task_config.json')
 
     # load try settings
     if 'try' in project:
         parameters['try_mode'] = None
         if os.path.isfile(task_config_file):
+            logger.info("using try tasks from {}".format(task_config_file))
             parameters['try_mode'] = 'try_task_config'
             with open(task_config_file, 'r') as fh:
                 parameters['try_task_config'] = json.load(fh)
         else:
             parameters['try_task_config'] = None
 
         if 'try:' in parameters['message']:
             parameters['try_mode'] = 'try_option_syntax'