Bug 1378454 - Add predictable routes to repackage and repackage-signing tasks r=Callek draft
authorRail Aliiev <rail@mozilla.com>
Fri, 07 Jul 2017 13:58:06 -0400
changeset 605386 5d540400c15c04ff354f191defc1c5337bc5b9ae
parent 605384 40a20e93d546ecb6b3a4b9567c18781b100e91cb
child 636485 69d3bd4030eca29db079149510f51a7b75a88de1
push id67401
push userbmo:rail@mozilla.com
push dateFri, 07 Jul 2017 17:59:08 +0000
reviewersCallek
bugs1378454
milestone56.0a1
Bug 1378454 - Add predictable routes to repackage and repackage-signing tasks r=Callek MozReview-Commit-ID: Kv59SWBdbz5
taskcluster/ci/repackage-signing/kind.yml
taskcluster/ci/repackage/kind.yml
taskcluster/docs/attributes.rst
taskcluster/taskgraph/transforms/gecko_v2_whitelist.py
taskcluster/taskgraph/transforms/repackage.py
taskcluster/taskgraph/transforms/repackage_routes.py
taskcluster/taskgraph/transforms/repackage_signing.py
taskcluster/taskgraph/transforms/task.py
--- a/taskcluster/ci/repackage-signing/kind.yml
+++ b/taskcluster/ci/repackage-signing/kind.yml
@@ -1,16 +1,17 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 loader: taskgraph.loader.single_dep:loader
 
 transforms:
    - taskgraph.transforms.repackage_signing:transforms
+   - taskgraph.transforms.repackage_routes:transforms
    - taskgraph.transforms.task:transforms
 
 kind-dependencies:
   - repackage
   - repackage-l10n
 
 only-for-build-platforms:
   - macosx64-nightly/opt
--- a/taskcluster/ci/repackage/kind.yml
+++ b/taskcluster/ci/repackage/kind.yml
@@ -1,16 +1,17 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 loader: taskgraph.loader.single_dep:loader
 
 transforms:
    - taskgraph.transforms.repackage:transforms
+   - taskgraph.transforms.repackage_routes:transforms
    - taskgraph.transforms.job:transforms
    - taskgraph.transforms.task:transforms
 
 kind-dependencies:
   - build-signing
 
 only-for-build-platforms:
   - macosx64-nightly/opt
--- a/taskcluster/docs/attributes.rst
+++ b/taskcluster/docs/attributes.rst
@@ -155,8 +155,13 @@ locale
 ======
 For jobs that operate on only one locale, we set the attribute ``locale`` to the
 specific locale involved. Currently this is only in l10n versions of the
 ``beetmover`` and ``balrog`` kinds.
 
 signed
 ======
 Signals that the output of this task contains signed artifacts.
+
+repackage_type
+==============
+This is the type of repackage. Can be ``repackage`` or 
+``repacakge_signing``.
--- a/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py
+++ b/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py
@@ -47,16 +47,18 @@ JOB_NAME_WHITELIST = set([
     'linux64-st-an-debug',
     'linux64-st-an-opt',
     'linux64-stylo-debug',
     'linux64-stylo-opt',
     'linux64-valgrind-opt',
     'macosx64-add-on-devel',
     'macosx64-clang-tidy',
     'macosx64-debug',
+    'macosx64-nightly-repackage',
+    'macosx64-nightly-repackage-signing',
     'macosx64-noopt-debug',
     'macosx64-opt',
     'macosx64-devedition-opt',
     'macosx64-st-an-debug',
     'macosx64-st-an-opt',
     'shell-haz-debug',
     'sm-arm-sim-debug',
     'sm-arm64-sim-debug',
@@ -77,16 +79,18 @@ JOB_NAME_WHITELIST = set([
     'win32-noopt-debug',
     'win32-opt',
     'win32-pgo',
     'win32-st-an-debug',
     'win32-st-an-opt',
     'win64-add-on-devel',
     'win64-clang-tidy',
     'win64-debug',
+    'win64-nightly-repackage',
+    'win64-nightly-repackage-signing',
     'win64-noopt-debug',
     'win64-opt',
     'win64-pgo',
     'win64-st-an-debug',
     'win64-st-an-opt',
     'win64-asan-debug',
     'win64-asan-opt',
 ])
--- a/taskcluster/taskgraph/transforms/repackage.py
+++ b/taskcluster/taskgraph/transforms/repackage.py
@@ -106,16 +106,17 @@ def make_job_description(config, jobs):
             # Which is needed in order to generate a new complete.mar
             dependencies['build'] = "build-{}/opt".format(
                 dependencies[build_task][13:dependencies[build_task].rfind('-')])
             build_task = 'build'
         signing_task_ref = "<{}>".format(signing_task)
         build_task_ref = "<{}>".format(build_task)
 
         attributes = copy_attributes_from_dependent_job(dep_job)
+        attributes['repackage_type'] = 'repackage'
 
         if job.get('locale'):
             attributes['locale'] = job['locale']
 
         level = config.params['level']
 
         task_env = {}
         locale_output_path = ""
new file mode 100644
--- /dev/null
+++ b/taskcluster/taskgraph/transforms/repackage_routes.py
@@ -0,0 +1,45 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+"""
+Add indexes to repackage kinds
+"""
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+from taskgraph.transforms.base import TransformSequence
+from taskgraph.util.schema import validate_schema
+from taskgraph.transforms.job import job_description_schema
+
+transforms = TransformSequence()
+
+
+@transforms.add
+def validate(config, jobs):
+    for job in jobs:
+        label = job['label']
+        yield validate_schema(
+            job_description_schema, job,
+            "In repackage-signing ({!r} kind) task for {!r}:".format(config.kind, label))
+
+
+@transforms.add
+def add_indexes(config, jobs):
+    for job in jobs:
+        repackage_type = job['attributes'].get('repackage_type')
+        if repackage_type:
+            build_platform = job['attributes']['build_platform']
+            job_name = '{}-{}'.format(build_platform, repackage_type)
+            product = job.get('index', {}).get('product', 'firefox')
+            index_type = 'generic'
+            if job['attributes'].get('nightly'):
+                index_type = 'nightly'
+            if job['attributes'].get('locale'):
+                index_type = 'l10n'
+            job['index'] = {
+                'job-name': job_name,
+                'product': product,
+                'type': index_type
+            }
+
+        yield job
--- a/taskcluster/taskgraph/transforms/repackage_signing.py
+++ b/taskcluster/taskgraph/transforms/repackage_signing.py
@@ -54,16 +54,17 @@ def make_repackage_signing_description(c
         label = job.get('label', "repackage-signing-{}".format(dep_job.label))
         dependencies = {"repackage": dep_job.label}
 
         signing_dependencies = dep_job.dependencies
         # This is so we get the build task etc in our dependencies to
         # have better beetmover support.
         dependencies.update(signing_dependencies)
         attributes = copy_attributes_from_dependent_job(dep_job)
+        attributes['repackage_type'] = 'repackage-signing'
 
         locale_str = ""
         if dep_job.attributes.get('locale'):
             treeherder['symbol'] = 'tc-rs({})'.format(dep_job.attributes.get('locale'))
             attributes['locale'] = dep_job.attributes.get('locale')
             locale_str = "{}/".format(dep_job.attributes.get('locale'))
 
         scopes = [get_signing_cert_scope(config),
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -869,16 +869,19 @@ def add_l10n_index_routes(config, task, 
     subs = config.params.copy()
     subs['job-name'] = job_name
     subs['build_date_long'] = time.strftime("%Y.%m.%d.%Y%m%d%H%M%S",
                                             time.gmtime(config.params['build_date']))
     subs['product'] = index['product']
 
     locales = task['attributes'].get('chunk_locales',
                                      task['attributes'].get('all_locales'))
+    # Some tasks has only one locale set
+    if task['attributes'].get('locale'):
+        locales = [task['attributes']['locale']]
 
     if force_locale:
         # Used for en-US and multi-locale
         locales = [force_locale]
 
     if not locales:
         raise Exception("Error: Unable to use l10n index for tasks without locales")