Bug 1421002: Add an option to control where to find the try_task_config.
MozReview-Commit-ID: ntC1fJOidr
--- 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'