Bug 1381577 - Part N; Make repackage task output its artifact to a locale included subdirectory, rather than rely on worker to publish there. r=kmoir draft
authorJustin Wood <Callek@gmail.com>
Tue, 18 Jul 2017 11:57:26 -0400
changeset 613356 5501d8d757c7408c9dd014bc04a8d36429bdd9b5
parent 613355 88c999c4c3a56efb8db0a7c5eed0f546987e9428
child 613357 1630a3b6b646a83abeb05000e77e0e3c3238250b
push id69770
push userCallek@gmail.com
push dateFri, 21 Jul 2017 20:09:14 +0000
reviewerskmoir
bugs1381577
milestone56.0a1
Bug 1381577 - Part N; Make repackage task output its artifact to a locale included subdirectory, rather than rely on worker to publish there. r=kmoir Land date changes to support windows nightlies onto central This will be needed for windows, because if the artifact is output to a folder that is, itself, an artifact folder, we'll end up publishing the named artifact twice. Which is unhelpful. MozReview-Commit-ID: 5S6SNul6Fm9
taskcluster/taskgraph/transforms/repackage.py
testing/mozharness/configs/repackage/osx_signed.py
testing/mozharness/scripts/repackage.py
--- a/taskcluster/taskgraph/transforms/repackage.py
+++ b/taskcluster/taskgraph/transforms/repackage.py
@@ -136,16 +136,20 @@ def make_job_description(config, jobs):
         worker = {
             'env': _generate_task_env(build_platform, build_task_ref,
                                       signing_task_ref, locale=locale),
             'artifacts': _generate_task_output_files(build_platform, locale=locale),
             'chain-of-trust': True,
             'max-run-time': 3600,
         }
 
+        if locale:
+            # Make sure we specify the locale-specific upload dir
+            worker['env'].update(LOCALE=locale)
+
         if build_platform.startswith('macosx'):
             worker_type = 'aws-provisioner-v1/gecko-%s-b-macosx64' % level
 
             run['tooltool-downloads'] = 'internal'
             worker['docker-image'] = {"in-tree": "desktop-build"},
 
             cot = job.setdefault('extra', {}).setdefault('chainOfTrust', {})
             cot.setdefault('inputs', {})['docker-image'] = {"task-reference": "<docker-image>"}
@@ -194,17 +198,19 @@ def _generate_taskcluster_prefix(task_id
     return _TC_ARTIFACT_LOCATION.format(task_id=task_id, postfix=postfix)
 
 
 def _generate_task_output_files(build_platform, locale=None):
     locale_output_path = '{}/'.format(locale) if locale else ''
     if build_platform.startswith('macosx'):
         return [{
             'type': 'file',
-            'path': '/home/worker/workspace/build/artifacts/target.dmg',
+            'path': '/home/worker/workspace/build/artifacts/{}target.dmg'
+                    .format(locale_output_path),
             'name': 'public/build/{}target.dmg'.format(locale_output_path),
         }, {
             'type': 'file',
-            'path': '/home/worker/workspace/build/artifacts/target.complete.mar',
+            'path': '/home/worker/workspace/build/artifacts/{}target.complete.mar'
+                    .format(locale_output_path),
             'name': 'public/build/{}target.complete.mar'.format(locale_output_path),
         }]
     else:
         raise NotImplemented('Unsupported build_platform: "{}"'.format(build_platform))
--- a/testing/mozharness/configs/repackage/osx_signed.py
+++ b/testing/mozharness/configs/repackage/osx_signed.py
@@ -1,15 +1,17 @@
 import os
 
 config = {
     "input_home": "{abs_work_dir}/inputs",
-    "output_home": "{abs_work_dir}/artifacts",
+    "output_home": "{abs_work_dir}/artifacts{locale}",
     "src_mozconfig": "browser/config/mozconfigs/macosx64/repack",
 
+    "locale": os.environ.get("LOCALE"),
+
     "download_config": {
         "target.tar.gz": os.environ.get("SIGNED_INPUT"),
         "mar": os.environ.get("UNSIGNED_MAR"),
     },
 
     "repackage_config": [[
         "dmg",
         "-i", "{abs_work_dir}/inputs/target.tar.gz",
--- a/testing/mozharness/scripts/repackage.py
+++ b/testing/mozharness/scripts/repackage.py
@@ -52,17 +52,21 @@ class Repackage(BaseScript):
         abs_dirs = super(Repackage, self).query_abs_dirs()
         config = self.config
         for directory in abs_dirs:
             value = abs_dirs[directory]
             abs_dirs[directory] = value
         dirs = {}
         dirs['abs_tools_dir'] = os.path.join(abs_dirs['abs_work_dir'], 'tools')
         dirs['abs_mozilla_dir'] = os.path.join(abs_dirs['abs_work_dir'], 'src')
-        dirs['output_home'] = config['output_home'].format(**abs_dirs)
+        locale_dir = ''
+        if config.get('locale'):
+            locale_dir = "{}{}".format(os.path.sep, config['locale'])
+        dirs['output_home'] = config['output_home'].format(locale=locale_dir, **abs_dirs)
+
         for key in dirs.keys():
             if key not in abs_dirs:
                 abs_dirs[key] = dirs[key]
         self.abs_dirs = abs_dirs
         return self.abs_dirs
 
     def repackage(self):
         config = self.config
@@ -84,16 +88,17 @@ class Repackage(BaseScript):
     def _run_tooltool(self):
         config = self.config
         dirs = self.query_abs_dirs()
         manifest_src = os.environ.get('TOOLTOOL_MANIFEST')
         if not manifest_src:
             manifest_src = config.get('tooltool_manifest_src')
         if not manifest_src:
             return self.warning(ERROR_MSGS['tooltool_manifest_undetermined'])
+
         tooltool_manifest_path = os.path.join(dirs['abs_mozilla_dir'],
                                               manifest_src)
         cmd = [
             sys.executable, '-u',
             os.path.join(dirs['abs_mozilla_dir'], 'mach'),
             'artifact',
             'toolchain',
             '-v',