Bug 1334624 - Set index routes for signing tasks based on build jobs. r=aki
authorJustin Wood <Callek@gmail.com>
Fri, 27 Jan 2017 14:24:31 -0500
changeset 479900 051a846e1094296aa346ddaf5ddc72223af47c3a
parent 479899 158233bce73892f5053d90076018719b3a48beb7
child 479901 4f30316c8432bdab8bc555e3551b695d62182069
push id44393
push userVYV03354@nifty.ne.jp
push dateTue, 07 Feb 2017 13:53:48 +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