Bug 1538995 - adjust repackage jobs to create partner stub installers, r=aki
authorNick Thomas <nthomas@mozilla.com>
Thu, 20 Jun 2019 22:17:55 +0000
changeset 537289 8000d797a95c551bad9b4fa333df186c9fc8e212
parent 537288 cdcd92299b6439b792d3e6644b1b6a5d93ac2607
child 537290 75411b55c8fcd7693efca7ec46b8776329f86d34
push id2128
push usernthomas@mozilla.com
push dateWed, 14 Aug 2019 02:49:25 +0000
treeherdermozilla-release@2254823049a2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaki
bugs1538995
milestone68.0.2
Bug 1538995 - adjust repackage jobs to create partner stub installers, r=aki On win32, where repack_stub_installer is enabled, extend the inputs to the partner repackage task so that it donwloads the upstream artifacts and creates the stub installer. Differential Revision: https://phabricator.services.mozilla.com/D34946
taskcluster/taskgraph/transforms/repackage_partner.py
--- a/taskcluster/taskgraph/transforms/repackage_partner.py
+++ b/taskcluster/taskgraph/transforms/repackage_partner.py
@@ -12,28 +12,34 @@ import copy
 from taskgraph.loader.single_dep import schema
 from taskgraph.transforms.base import TransformSequence
 from taskgraph.util.attributes import copy_attributes_from_dependent_job
 from taskgraph.util.schema import (
     optionally_keyed_by,
     resolve_keyed_by,
 )
 from taskgraph.util.taskcluster import get_artifact_prefix
-from taskgraph.util.partners import check_if_partners_enabled
+from taskgraph.util.partners import check_if_partners_enabled, get_partner_config_by_kind
 from taskgraph.util.platforms import archive_format, executable_extension
 from taskgraph.util.workertypes import worker_type_implementation
 from taskgraph.transforms.task import task_description_schema
-from taskgraph.transforms.repackage import PACKAGE_FORMATS
+from taskgraph.transforms.repackage import PACKAGE_FORMATS as PACKAGE_FORMATS_VANILLA
 from voluptuous import Required, Optional
 
 
 def _by_platform(arg):
     return optionally_keyed_by('build-platform', arg)
 
 
+# When repacking the stub installer we need to pass a zip file and package name to the
+# repackage task. This is not needed for vanilla stub but analogous to the full installer.
+PACKAGE_FORMATS = copy.deepcopy(PACKAGE_FORMATS_VANILLA)
+PACKAGE_FORMATS['installer-stub']['inputs']['package'] = 'target-stub{archive_format}'
+PACKAGE_FORMATS['installer-stub']['args'].extend(["--package-name", "{package-name}"])
+
 packaging_description_schema = schema.extend({
     # depname is used in taskref's to identify the taskID of the signed things
     Required('depname', default='build'): basestring,
 
     # unique label to describe this repackaging task
     Optional('label'): basestring,
 
     # Routes specific to this task, if defined
@@ -125,16 +131,22 @@ def make_job_description(config, jobs):
                 signing_task = dependency
             elif build_platform.startswith('win') and dependency.endswith('repack'):
                 signing_task = dependency
 
         attributes['repackage_type'] = 'repackage'
 
         repack_id = job['extra']['repack_id']
 
+        partner_config = get_partner_config_by_kind(config, config.kind)
+        partner, subpartner, _ = repack_id.split('/')
+        repack_stub_installer = partner_config[partner][subpartner].get('repack_stub_installer')
+        if build_platform.startswith('win32') and repack_stub_installer:
+            job['package-formats'].append('installer-stub')
+
         repackage_config = []
         for format in job.get('package-formats'):
             command = copy.deepcopy(PACKAGE_FORMATS[format])
             substs = {
                 'archive_format': archive_format(build_platform),
                 'executable_extension': executable_extension(build_platform),
             }
             command['inputs'] = {
@@ -203,51 +215,59 @@ def make_job_description(config, jobs):
             'scopes': ['queue:get-artifact:releng/partner/*'],
             'run-on-projects': dep_job.attributes.get('run_on_projects'),
             'routes': job.get('routes', []),
             'extra': job.get('extra', {}),
             'worker': worker,
             'run': run,
             'fetches': _generate_download_config(dep_job, build_platform,
                                                  signing_task, partner=repack_id,
-                                                 project=config.params["project"]),
+                                                 project=config.params["project"],
+                                                 repack_stub_installer=repack_stub_installer),
         }
 
         if build_platform.startswith('macosx'):
             task['toolchains'] = [
                 'linux64-libdmg',
                 'linux64-hfsplus',
                 'linux64-node',
             ]
         yield task
 
 
 def _generate_download_config(task, build_platform, signing_task, partner=None,
-                              project=None):
+                              project=None, repack_stub_installer=False):
     locale_path = '{}/'.format(partner) if partner else ''
 
     if build_platform.startswith('macosx'):
         return {
             signing_task: [
                 {
                     'artifact': '{}target.tar.gz'.format(locale_path),
                     'extract': False,
                 },
             ],
         }
     elif build_platform.startswith('win'):
-        return {
-            signing_task: [
+        download_config = [
+            {
+                'artifact': '{}target.zip'.format(locale_path),
+                'extract': False,
+            },
+            '{}setup.exe'.format(locale_path),
+        ]
+        if build_platform.startswith('win32') and repack_stub_installer:
+            download_config.extend([
                 {
-                    'artifact': '{}target.zip'.format(locale_path),
+                    'artifact': '{}target-stub.zip'.format(locale_path),
                     'extract': False,
                 },
-                '{}setup.exe'.format(locale_path),
-            ],
-        }
+                '{}setup-stub.exe'.format(locale_path),
+            ])
+        return {signing_task: download_config}
 
     raise NotImplementedError('Unsupported build_platform: "{}"'.format(build_platform))
 
 
 def _generate_task_output_files(task, worker_implementation, repackage_config, partner):
     """We carefully generate an explicit list here, but there's an artifacts directory
     too, courtesy of generic_worker_add_artifacts() (windows) or docker_worker_add_artifacts().
     Any errors here are likely masked by that.