Bug 1301720: ensure Buildbot and TaskCluster v2 routes match; r=mshal
authorDustin J. Mitchell <dustin@mozilla.com>
Fri, 16 Sep 2016 15:08:57 +0000
changeset 314264 a76f19132914a2e8d17aa909162139d3a5916b05
parent 314263 6bb882a439ac20e8c8b1533f88b268a404d63b34
child 314265 94cb2bf70c74358ac1645eb15bee59381dd3d73a
push id30717
push userphilringnalda@gmail.com
push dateSat, 17 Sep 2016 20:38:05 +0000
treeherdermozilla-central@b3aa1f62ce68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1301720
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1301720: ensure Buildbot and TaskCluster v2 routes match; r=mshal MozReview-Commit-ID: 40FmcJWkIIo
taskcluster/taskgraph/transforms/task.py
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -5,16 +5,17 @@
 These transformations take a task description and turn it into a TaskCluster
 task definition (along with attributes, label, etc.).  The input to these
 transformations is generic to any kind of task, but abstracts away some of the
 complexities of worker implementations, scopes, and treeherder annotations.
 """
 
 from __future__ import absolute_import, print_function, unicode_literals
 
+import json
 import time
 
 from taskgraph.util.treeherder import split_symbol
 from taskgraph.transforms.base import (
     validate_schema,
     TransformSequence
 )
 from voluptuous import Schema, Any, Required, Optional, Extra
@@ -522,8 +523,33 @@ def build_task(config, tasks):
 
         yield {
             'label': task['label'],
             'task': task_def,
             'dependencies': task.get('dependencies', {}),
             'attributes': attributes,
             'when': task.get('when', {}),
         }
+
+
+# Check that the v2 route templates match those used by Mozharness.  This can
+# go away once Mozharness builds are no longer performed in Buildbot, and the
+# Mozharness code referencing routes.json is deleted.
+def check_v2_routes():
+    with open("testing/mozharness/configs/routes.json", "rb") as f:
+        routes_json = json.load(f)
+
+    # we only deal with the 'routes' key here
+    routes = routes_json['routes']
+
+    # we use different variables than mozharness
+    for mh, tg in [
+        ('{index}', 'index'),
+        ('{build_product}', '{product}'),
+        ('{build_name}-{build_type}', '{job-name-gecko-v2}'),
+        ('{year}.{month}.{day}.{pushdate}', '{pushdate_long}')]:
+        routes = [r.replace(mh, tg) for r in routes]
+
+    if sorted(routes) != sorted(V2_ROUTE_TEMPLATES):
+        raise Exception("V2_ROUTE_TEMPLATES does not match Mozharness's routes.json: "
+                        "%s vs %s" % (V2_ROUTE_TEMPLATES, routes))
+
+check_v2_routes()