bug 1455692: add support for limiting locales in partner repacks. r=nthomas
authorBen Hearsum <bhearsum@mozilla.com>
Mon, 07 May 2018 07:57:53 -0400
changeset 818127 1ccaff5a61624f2e36e68ecdd1c98dd62a980d4a
parent 818126 9db70a54f47cc819736da8b6772ba8f17a8585cb
child 818128 c23bf868958709b264a0983dd97c4c05e33f400b
push id116246
push userbmo:tom@mozilla.com
push dateFri, 13 Jul 2018 20:48:08 +0000
reviewersnthomas
bugs1455692
milestone60.1.1
bug 1455692: add support for limiting locales in partner repacks. r=nthomas
taskcluster/ci/release-eme-free-repack/kind.yml
taskcluster/ci/release-partner-repack/kind.yml
taskcluster/taskgraph/transforms/partner_repack.py
testing/mozharness/scripts/desktop_partner_repacks.py
--- a/taskcluster/ci/release-eme-free-repack/kind.yml
+++ b/taskcluster/ci/release-eme-free-repack/kind.yml
@@ -36,16 +36,23 @@ job-defaults:
    run:
       using: mozharness
       config:
          - partner_repacks/release_mozilla-release_desktop.py
       script: mozharness/scripts/desktop_partner_repacks.py
       job-script: taskcluster/scripts/builder/repackage.sh
       need-xvfb: false
       tooltool-downloads: false
+   extra:
+      limit-locales:
+         by-project:
+            birch: true
+            jamun: true
+            maple: true
+            default: false
 
 jobs:
    macosx64-nightly:
       treeherder:
          symbol: EME
          platform: macosx64/opt
          kind: test
          tier: 1
--- a/taskcluster/ci/release-partner-repack/kind.yml
+++ b/taskcluster/ci/release-partner-repack/kind.yml
@@ -36,16 +36,23 @@ job-defaults:
    run:
       using: mozharness
       config:
          - partner_repacks/release_mozilla-release_desktop.py
       script: mozharness/scripts/desktop_partner_repacks.py
       job-script: taskcluster/scripts/builder/repackage.sh
       need-xvfb: false
       tooltool-downloads: false
+   extra:
+      limit-locales:
+         by-project:
+            birch: true
+            jamun: true
+            maple: true
+            default: false
 
 jobs:
    linux-nightly:
       attributes:
          build_platform: linux-nightly
          build_type: opt
          artifact_prefix: releng/partner
          nightly: true
--- a/taskcluster/taskgraph/transforms/partner_repack.py
+++ b/taskcluster/taskgraph/transforms/partner_repack.py
@@ -18,16 +18,20 @@ transforms = TransformSequence()
 
 @transforms.add
 def resolve_properties(config, tasks):
     for task in tasks:
         for property in ("REPACK_MANIFESTS_URL", ):
             property = "worker.env.{}".format(property)
             resolve_keyed_by(task, property, property, **config.params)
 
+        for property in ("limit-locales", ):
+            property = "extra.{}".format(property)
+            resolve_keyed_by(task, property, property, **config.params)
+
         if task['worker']['env']['REPACK_MANIFESTS_URL'].startswith('git@'):
             task.setdefault('scopes', []).append(
                 'secrets:get:project/releng/gecko/build/level-{level}/partner-github-ssh'.format(
                     **config.params
                 )
             )
 
         yield task
@@ -38,23 +42,31 @@ def make_label(config, tasks):
     for task in tasks:
         task['label'] = "{}-{}".format(config.kind, task['name'])
         yield task
 
 
 @transforms.add
 def add_command_arguments(config, tasks):
     release_config = get_release_config(config)
+    all_locales = set()
+    for partner_class in config.params['release_partner_config'].values():
+        for partner in partner_class.values():
+            for sub_partner in partner.values():
+                all_locales.update(sub_partner.get('locales', []))
     for task in tasks:
         # add the MOZHARNESS_OPTIONS, eg version=61.0, build-number=1, platform=win64
         task['run']['options'] = [
             'version={}'.format(release_config['version']),
             'build-number={}'.format(release_config['build_number']),
             'platform={}'.format(task['attributes']['build_platform'].split('-')[0]),
         ]
+        if task['extra']['limit-locales']:
+            for locale in all_locales:
+                task['run']['options'].append('limit-locale={}'.format(locale))
 
         # The upstream taskIds are stored a special environment variable, because we want to use
         # task-reference's to resolve dependencies, but the string handling of MOZHARNESS_OPTIONS
         # blocks that. It's space-separated string of ids in the end.
         task['worker']['env']['UPSTREAM_TASKIDS'] = {
             'task-reference': ' '.join(['<{}>'.format(dep) for dep in task['dependencies']])
         }
 
--- a/testing/mozharness/scripts/desktop_partner_repacks.py
+++ b/testing/mozharness/scripts/desktop_partner_repacks.py
@@ -51,16 +51,20 @@ class DesktopPartnerRepacks(ReleaseMixin
           "dest": "partner",
           "help": "Limit repackaging to partners matching this string",
           }],
         [["--taskid", "-t"], {
             "dest": "taskIds",
             "action": "extend",
             "help": "taskId(s) of upstream tasks for vanilla Firefox artifacts",
         }],
+        [["--limit-locale", "-l"], {
+            "dest": "limitLocales",
+            "action": "append",
+        }],
     ]
 
     def __init__(self):
         # fxbuild style:
         buildscript_kwargs = {
             'all_actions': DesktopPartnerRepacks.actions,
             'default_actions': DesktopPartnerRepacks.actions,
             'config': {
@@ -157,16 +161,19 @@ class DesktopPartnerRepacks(ReleaseMixin
                       "-n", str(self.config['build_number'])]
         if self.config.get('platform'):
             repack_cmd.extend(["--platform", self.config['platform']])
         if self.config.get('partner'):
             repack_cmd.extend(["--partner", self.config['partner']])
         if self.config.get('taskIds'):
             for taskId in self.config['taskIds']:
                 repack_cmd.extend(["--taskid", taskId])
+        if self.config.get("limitLocales"):
+            for locale in self.config["limitLocales"]:
+                repack_cmd.extend(["--limit-locale", locale])
 
         self.run_command(repack_cmd,
                          cwd=self.query_abs_dirs()['abs_scripts_dir'],
                          halt_on_failure=True)
 
 
 # main {{{
 if __name__ == '__main__':