Bug 1378212 - Give cron-based decision tasks unique index routes, r?dustin
We'd like to use routes like:
index.gecko.v2.mozilla-central.latest.firefox.decision
to automatically find the latest parameters.yml file from a decision task. Unfortunately,
sometimes the latest decision task happens to be triggered by a cron job which uses a different
target_tasks method and therefore won't generate the expected tasks.
This patch *should* create a different index for these types of decision tasks, though I'm not
sure how I can test it before pushing.
MozReview-Commit-ID: 1993ISgb1Dn
--- a/taskcluster/taskgraph/cron/decision.py
+++ b/taskcluster/taskgraph/cron/decision.py
@@ -60,16 +60,21 @@ def make_decision_task(params, symbol, a
task = yaml.load(taskcluster_yml)['tasks'][0]['task']
# set some metadata
task['metadata']['name'] = 'Decision task for cron job ' + params['job_name']
cron_task_id = os.environ.get('TASK_ID', '<cron task id>')
descr_md = 'Created by a [cron task](https://tools.taskcluster.net/task-inspector/#{}/)'
task['metadata']['description'] = descr_md.format(cron_task_id)
+ # create new indices so these aren't mixed in with regular decision tasks
+ for i, route in enumerate(task['routes']):
+ if route.startswith('index'):
+ task['routes'][i] = route + '-' + params['job_name']
+
th = task['extra']['treeherder']
th['groupSymbol'] = 'cron'
th['symbol'] = symbol
# add a scope based on the repository, with a cron:<job_name> suffix
match = re.match(r'https://(hg.mozilla.org)/(.*?)/?$', params['head_repository'])
if not match:
raise Exception('Unrecognized head_repository')