Bug 1334624 - Set index routes for signing tasks based on build jobs. r=aki draft
authorJustin Wood <Callek@gmail.com>
Fri, 27 Jan 2017 14:24:31 -0500
changeset 479135 180dfee0fa7dd16af5ef496a5b8abf59aefe5b03
parent 479117 6c998914bad21a65c7fe2ee7e8c1c7f5269c750d
child 544590 1aeba1b1637a695d44e2d70d97b5b2dd5b072863
push id44150
push userCallek@gmail.com
push dateMon, 06 Feb 2017 01:17:20 +0000
reviewersaki
bugs1334624
milestone54.0a1
Bug 1334624 - Set index routes for signing tasks based on build jobs. r=aki MozReview-Commit-ID: BhO0FTo3DKk
taskcluster/taskgraph/transforms/build_signing.py
taskcluster/taskgraph/transforms/signing.py
--- a/taskcluster/taskgraph/transforms/build_signing.py
+++ b/taskcluster/taskgraph/transforms/build_signing.py
@@ -8,16 +8,35 @@ Transform the signing task into an actua
 from __future__ import absolute_import, print_function, unicode_literals
 
 from taskgraph.transforms.base import TransformSequence
 
 transforms = TransformSequence()
 
 
 @transforms.add
+def add_signed_routes(config, jobs):
+    """Add routes corresponding to the routes of the build task
+       this corresponds to, with .signed inserted, for all gecko.v2 routes"""
+
+    for job in jobs:
+        dep_job = job['dependent-task']
+
+        job['routes'] = []
+        for dep_route in dep_job.task.get('routes', []):
+            if not dep_route.startswith('index.gecko.v2'):
+                continue
+            branch = dep_route.split(".")[3]
+            rest = ".".join(dep_route.split(".")[4:])
+            job['routes'].append(
+                'index.gecko.v2.{}.signed-nightly.{}'.format(branch, rest))
+        yield job
+
+
+@transforms.add
 def make_signing_description(config, jobs):
     for job in jobs:
         dep_job = job['dependent-task']
 
         if 'android' in dep_job.attributes.get('build_platform'):
             job_specs = [
                 {
                     'artifacts': ['public/build/target.apk',
--- a/taskcluster/taskgraph/transforms/signing.py
+++ b/taskcluster/taskgraph/transforms/signing.py
@@ -53,16 +53,19 @@ signing_description_schema = Schema({
     # unique label to describe this signing task, defaults to {dep.label}-signing
     Optional('label'): basestring,
 
     # treeherder is allowed here to override any defaults we use for signing.  See
     # taskcluster/taskgraph/transforms/task.py for the schema details, and the
     # below transforms for defaults of various values.
     Optional('treeherder'): task_description_schema['treeherder'],
 
+    # Routes specific to this task, if defined
+    Optional('routes'): [basestring],
+
     # If True, adds a route which funsize uses to schedule generation of partial mar
     # files for updates. Expected to be added on nightly builds only.
     Optional('use-funsize-route'): bool,
 })
 
 
 @transforms.add
 def validate(config, jobs):
@@ -113,15 +116,16 @@ def make_task_description(config, jobs):
             'worker': {'implementation': 'scriptworker-signing',
                        'upstream-artifacts': job['upstream-artifacts'],
                        'max-run-time': 3600},
             'scopes': ["project:releng:signing:cert:nightly-signing"] + signing_format_scopes,
             'dependencies': {job['depname']: dep_job.label},
             'attributes': attributes,
             'run-on-projects': dep_job.attributes.get('run_on_projects'),
             'treeherder': treeherder,
+            'routes': job.get('routes', []),
         }
 
         if job.get('use-funsize-route', False):
-            task['routes'] = ["index.project.releng.funsize.level-{level}.{project}".format(
-                project=config.params['project'], level=config.params['level'])]
+            task['routes'].append("index.project.releng.funsize.level-{level}.{project}".format(
+                project=config.params['project'], level=config.params['level']))
 
         yield task