Bug 1378212 - Give cron-based decision tasks unique index routes, r?dustin draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 04 Jul 2017 16:09:58 -0400
changeset 604188 87455709605cda2da98cba44cfd97d7eb9913e6b
parent 604013 0893f6685e154aaa3252ed091abb16a2feb2806d
child 604189 8a0108d21bd3bdebaf79b2c9d8669de946251644
push id66991
push userahalberstadt@mozilla.com
push dateWed, 05 Jul 2017 14:21:52 +0000
reviewersdustin
bugs1378212
milestone56.0a1
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
taskcluster/taskgraph/cron/decision.py
--- 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')