Bug 1381577 - 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 611728 aee3d31c0bd2fb98be5a3f84535a9713d1da8e9c
parent 611727 2b8c585e8c0ab817f366f7a1704659656b68cd8f
child 611729 a4bf71c09960d7b55723bfb3d760b34642e73f79
push id69287
push userCallek@gmail.com
push dateThu, 20 Jul 2017 01:11:37 +0000
reviewerskmoir
bugs1381577
milestone56.0a1
Bug 1381577 - 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',