Bug 1357867 - add support for 'ignore-locales' in tc l10n jobs. r=dustin
authorJustin Wood <Callek@gmail.com>
Wed, 19 Apr 2017 10:35:18 -0400
changeset 566276 cc380e839a309164bf9e1b28cf5400dd2ee7082c
parent 566275 4fb4020b8c8ba8f81a1c4c71f24494be526fd2b5
child 566277 e873713a2a8167a7cc248379d2c0a85684beb1c5
push id55180
push userjjong@mozilla.com
push dateFri, 21 Apr 2017 09:36:13 +0000
reviewersdustin
bugs1357867
milestone55.0a1
Bug 1357867 - add support for 'ignore-locales' in tc l10n jobs. r=dustin MozReview-Commit-ID: ENKm5mOG3BH
taskcluster/ci/l10n/kind.yml
taskcluster/ci/nightly-l10n/kind.yml
taskcluster/taskgraph/transforms/l10n.py
--- a/taskcluster/ci/l10n/kind.yml
+++ b/taskcluster/ci/l10n/kind.yml
@@ -23,16 +23,21 @@ job-template:
    description:
       by-build-platform:
          default: Localization
          android-api-15-l10n: Single Locale Repack
    locales-file:
       by-build-platform:
          default: browser/locales/all-locales
          android-api-15-l10n: mobile/locales/l10n-changesets.json
+   ignore-locales:
+      by-build-platform:
+         # OSX has a special locale for japanese
+         macosx64.*: [ja]
+         default: [ja-JP-mac]
    run-time:
       by-build-platform:
          default: 36000
          android-api-15-l10n: 18000
    tooltool:
       by-build-platform:
          default: public
          android-api-15-l10n: internal
--- a/taskcluster/ci/nightly-l10n/kind.yml
+++ b/taskcluster/ci/nightly-l10n/kind.yml
@@ -27,16 +27,21 @@ job-template:
       by-build-platform:
          default: browser/locales/all-locales
          android-api-15-nightly: mobile/locales/l10n-changesets.json
    chunks: 6
    run-on-projects:
      - mozilla-central
      - mozilla-aurora
      - mozilla-beta
+   ignore-locales:
+      by-build-platform:
+         # OSX has a special locale for japanese
+         macosx64.*: [ja]
+         default: [ja-JP-mac]
    run-time:
       by-build-platform:
          default: 36000
          android-api-15-nightly: 18000
    tooltool:
       by-build-platform:
          default: public
          android-api-15-nightly: internal
--- a/taskcluster/taskgraph/transforms/l10n.py
+++ b/taskcluster/taskgraph/transforms/l10n.py
@@ -46,16 +46,19 @@ l10n_description_schema = Schema({
     Required('name'): basestring,
 
     # build-platform, inferred from dependent job before validation
     Required('build-platform'): basestring,
 
     # max run time of the task
     Required('run-time'): _by_platform(int),
 
+    # Locales not to repack for
+    Required('ignore-locales'): _by_platform([basestring]),
+
     # All l10n jobs use mozharness
     Required('mozharness'): {
         # Script to invoke for mozharness
         Required('script'): _by_platform(basestring),
 
         # Config files passed to the mozharness script
         Required('config'): _by_platform([basestring]),
 
@@ -145,21 +148,21 @@ def _parse_locales_file(locales_file, pl
             }
         else:
             all_locales = f.read().split()
             # 'default' is the hg revision at the top of hg repo, in this context
             locales = {locale: 'default' for locale in all_locales}
     return locales
 
 
-def _remove_ja_jp_mac_locale(locales):
+def _remove_locales(locales, to_remove=None):
     # ja-JP-mac is a mac-only locale, but there are no mac builds being repacked,
     # so just omit it unconditionally
     return {
-        locale: revision for locale, revision in locales.items() if locale != 'ja-JP-mac'
+        locale: revision for locale, revision in locales.items() if locale not in to_remove
     }
 
 
 @transforms.add
 def setup_name(config, jobs):
     for job in jobs:
         dep = job['dependent-task']
         if dep.attributes.get('nightly'):
@@ -220,16 +223,17 @@ def handle_keyed_by(config, jobs):
     fields = [
         "locales-file",
         "chunks",
         "worker-type",
         "description",
         "run-time",
         "tooltool",
         "env",
+        "ignore-locales",
         "mozharness.config",
         "mozharness.options",
         "mozharness.actions",
         "mozharness.script",
         "treeherder.tier",
         "treeherder.platform",
         "index.product",
         "index.job-name",
@@ -241,17 +245,18 @@ def handle_keyed_by(config, jobs):
             resolve_keyed_by(item=job, field=field, item_name=job['name'])
         yield job
 
 
 @transforms.add
 def all_locales_attribute(config, jobs):
     for job in jobs:
         locales_with_changesets = _parse_locales_file(job["locales-file"])
-        locales_with_changesets = _remove_ja_jp_mac_locale(locales_with_changesets)
+        locales_with_changesets = _remove_locales(locales_with_changesets,
+                                                  to_remove=job['ignore-locales'])
 
         locales = sorted(locales_with_changesets.keys())
         attributes = job.setdefault('attributes', {})
         attributes["all_locales"] = locales
         attributes["all_locales_with_changesets"] = locales_with_changesets
         yield job