Bug 1306598 - update l10n kind to not hardcode 'try' in options. r=dustin
authorJustin Wood <Callek@gmail.com>
Thu, 29 Sep 2016 14:59:49 -0400
changeset 316629 dc1926812404261239dd147031a18141ecca0d55
parent 316628 23b4707ed4f9de2bf97d50857cf3547e525eefee
child 316630 27a1e1bfcfbbffe10f6b6e2451e61081a4718597
push id30778
push usercbook@mozilla.com
push dateThu, 06 Oct 2016 09:56:14 +0000
treeherdermozilla-central@cc3ee8d499c5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1306598
milestone52.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 1306598 - update l10n kind to not hardcode 'try' in options. r=dustin MozReview-Commit-ID: Hmj51RZSkf6
taskcluster/ci/l10n/kind.yml
taskcluster/taskgraph/transforms/l10n.py
--- a/taskcluster/ci/l10n/kind.yml
+++ b/taskcluster/ci/l10n/kind.yml
@@ -2,16 +2,17 @@
 # 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/.
 
 # NOTE: please write a description of this kind in taskcluster/docs/kinds.rst
 
 implementation: taskgraph.task.transform:TransformTask
 
 transforms:
+   - taskgraph.transforms.l10n:transforms
    - taskgraph.transforms.build_attrs:transforms
    - taskgraph.transforms.job:transforms
    - taskgraph.transforms.task:transforms
 
 job-defaults:
     index:
         product: firefox
     treeherder:
@@ -53,18 +54,18 @@ jobs:
         run:
             using: mozharness
             script: mozharness/scripts/desktop_l10n.py
             actions: [clone-locales list-locales setup repack summary]
             config:
                 - single_locale/tc_linux32.py
             options:
                 - environment-config=single_locale/production.py
-                - branch-config=single_locale/try.py # NOTE: this will need to be modified in a transform..
-                - platform-config=single_locale/linux32.py  # same
+                - branch-config=single_locale/{project}.py
+                - platform-config=single_locale/linux32.py
                 - total-chunks=1
                 - this-chunk=1
             tooltool-downloads: public
             need-xvfb: true
 
     linux64-l10n/opt:
         description: "Localization"
         index:
@@ -76,17 +77,17 @@ jobs:
         run:
             using: mozharness
             script: mozharness/scripts/desktop_l10n.py
             actions: [clone-locales list-locales setup repack summary]
             config:
                 - single_locale/tc_linux64.py
             options:
                 - environment-config=single_locale/production.py
-                - branch-config=single_locale/try.py
+                - branch-config=single_locale/{project}.py
                 - platform-config=single_locale/linux64.py
                 - total-chunks=1
                 - this-chunk=1
             tooltool-downloads: public
             need-xvfb: true
 
     android-api-15-l10n/opt:
         description: "Single Locale Repack"
@@ -99,15 +100,16 @@ jobs:
             symbol: tc(L10n)
         worker-type: aws-provisioner-v1/android-api-15
         worker:
             max-run-time: 18000
         run:
             using: mozharness
             script: mozharness/scripts/mobile_l10n.py
             actions: [clone-locales list-locales setup repack upload-repacks summary]
-            config:  # NOTE: this will need to be modified in a transform..
-                - single_locale/try_android-api-15.py single_locale/tc_android-api-15.py
+            config:
+                - single_locale/{project}_android-api-15.py
+                - single_locale/tc_android-api-15.py
             options:
                 - total-chunks=1
                 - this-chunk=1
             tooltool-downloads: internal
             need-xvfb: true
new file mode 100644
--- /dev/null
+++ b/taskcluster/taskgraph/transforms/l10n.py
@@ -0,0 +1,44 @@
+# 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/.
+"""
+Do transforms specific to l10n kind
+"""
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+from taskgraph.transforms.base import TransformSequence
+
+transforms = TransformSequence()
+
+
+@transforms.add
+def mh_config_replace_project(config, jobs):
+    """ Replaces {project} in mh config entries with the current project """
+    # XXXCallek This is a bad pattern but exists to satisfy ease-of-porting for buildbot
+    for job in jobs:
+        if not job['run'].get('using') == 'mozharness':
+            # Nothing to do, not mozharness
+            yield job
+            continue
+        job['run']['config'] = map(
+            lambda x: x.format(project=config.params['project']),
+            job['run']['config']
+            )
+        yield job
+
+
+@transforms.add
+def mh_options_replace_project(config, jobs):
+    """ Replaces {project} in mh option entries with the current project """
+    # XXXCallek This is a bad pattern but exists to satisfy ease-of-porting for buildbot
+    for job in jobs:
+        if not job['run'].get('using') == 'mozharness':
+            # Nothing to do, not mozharness
+            yield job
+            continue
+        job['run']['options'] = map(
+            lambda x: x.format(project=config.params['project']),
+            job['run']['options']
+            )
+        yield job