Bug 1421002: Add an option to control where to find the try_task_config. r=dustin

MozReview-Commit-ID: ntC1fJOidr

--HG--
extra : rebase_source : 7bd3ace5b127fca978b9e5ec6a2d0670ff931af9
extra : source : 43903d5d0cfdf57cc39c643dc1d1f577a6fc8901
This commit is contained in:
Tom Prince 2017-11-21 11:26:56 -07:00
parent 80589e1731
commit 3890179b24
2 changed files with 8 additions and 2 deletions

View File

@ -152,6 +152,8 @@ class MachCommands(MachCommandBase):
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,

View File

@ -203,13 +203,17 @@ def get_decision_parameters(options):
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)