Bug 1488127 - Make 52 -> 60 updates signed with the old mar scheme (instead of mar_384) r=tomprince a=release
☠☠ backed out by a3a342f7ab78 ☠ ☠
authorJohan Lorenzo <jlorenzo@mozilla.com>
Mon, 03 Sep 2018 06:09:04 +0000
changeset 482977 f9f5910f9c988b95c6a7392fcc1f5c2ecd63e4af
parent 482877 f8fe981dd967ac0435af743aff48b9743df719ad
child 482978 91511a8d050201bf5c93e82fe9f3ef2c0cad630c
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewerstomprince, release
bugs1488127
milestone63.0a1
Bug 1488127 - Make 52 -> 60 updates signed with the old mar scheme (instead of mar_384) r=tomprince a=release Make 52 -> 60 updates signed with the old mar scheme (instead of mar_384) Differential Revision: https://phabricator.services.mozilla.com/D4841
taskcluster/taskgraph/transforms/beetmover_repackage.py
taskcluster/taskgraph/transforms/partials_signing.py
taskcluster/taskgraph/util/partials.py
--- a/taskcluster/taskgraph/transforms/beetmover_repackage.py
+++ b/taskcluster/taskgraph/transforms/beetmover_repackage.py
@@ -329,18 +329,18 @@ def generate_upstream_artifacts(job, dep
 def generate_partials_upstream_artifacts(job, artifacts, platform, locale=None):
     artifact_prefix = get_artifact_prefix(job)
     if locale and locale != 'en-US':
         artifact_prefix = '{}/{}'.format(artifact_prefix, locale)
 
     upstream_artifacts = [{
         'taskId': {'task-reference': '<partials-signing>'},
         'taskType': 'signing',
-        'paths': ["{}/{}".format(artifact_prefix, p)
-                  for p in artifacts],
+        'paths': ["{}/{}".format(artifact_prefix, path)
+                  for path, _ in artifacts],
         'locale': locale or 'en-US',
     }]
 
     return upstream_artifacts
 
 
 def _check_platform_matched_only_one_regex(
     task_type, platform, platform_was_previously_matched_by_regex, platform_regex
--- a/taskcluster/taskgraph/transforms/partials_signing.py
+++ b/taskcluster/taskgraph/transforms/partials_signing.py
@@ -28,24 +28,46 @@ def generate_upstream_artifacts(job, rel
     else:
         locale = 'en-US'
 
     artifacts = get_partials_artifacts(release_history, platform, locale)
 
     upstream_artifacts = [{
         "taskId": {"task-reference": '<partials>'},
         "taskType": 'partials',
-        "paths": ["{}/{}".format(artifact_prefix, p)
-                  for p in artifacts],
+        "paths": [
+            "{}/{}".format(artifact_prefix, path)
+            for path, version in artifacts
+            # TODO Use mozilla-version to avoid comparing strings. Otherwise Firefox 100 will be
+            # considered smaller than Firefox 56
+            if version is None or version >= '56'
+        ],
         "formats": ["mar_sha384"],
     }]
 
+    old_mar_upstream_artifacts = {
+        "taskId": {"task-reference": '<partials>'},
+        "taskType": 'partials',
+        "paths": [
+            "{}/{}".format(artifact_prefix, path)
+            for path, version in artifacts
+            # TODO Use mozilla-version to avoid comparing strings. Otherwise Firefox 100 will be
+            # considered smaller than Firefox 56
+            if version is not None and version < '56'
+        ],
+        "formats": ["mar"],
+    }
+
+    if old_mar_upstream_artifacts["paths"]:
+        upstream_artifacts.append(old_mar_upstream_artifacts)
+
     return upstream_artifacts
 
 
+
 @transforms.add
 def make_task_description(config, jobs):
     for job in jobs:
         dep_job = job['dependent-task']
 
         treeherder = job.get('treeherder', {})
         treeherder.setdefault('symbol', 'ps(N)')
 
@@ -76,17 +98,21 @@ def make_task_description(config, jobs):
         upstream_artifacts = generate_upstream_artifacts(
             dep_job, config.params['release_history'], balrog_platform, locale)
 
         build_platform = dep_job.attributes.get('build_platform')
         is_nightly = dep_job.attributes.get('nightly')
         signing_cert_scope = get_signing_cert_scope_per_platform(
             build_platform, is_nightly, config
         )
+
         scopes = [signing_cert_scope, 'project:releng:signing:format:mar_sha384']
+        if any("mar" in upstream_details["formats"] for upstream_details in upstream_artifacts):
+            scopes.append('project:releng:signing:format:mar')
+
         task = {
             'label': label,
             'description': "{} Partials".format(
                 dep_job.task["metadata"]["description"]),
             'worker-type': get_worker_type_for_scope(config, signing_cert_scope),
             'worker': {'implementation': 'scriptworker-signing',
                        'upstream-artifacts': upstream_artifacts,
                        'max-run-time': 3600},
--- a/taskcluster/taskgraph/util/partials.py
+++ b/taskcluster/taskgraph/util/partials.py
@@ -86,17 +86,20 @@ def get_builds(release_history, platform
     """Examine cached balrog release history and return the list of
     builds we need to generate diffs from"""
     platform = _sanitize_platform(platform)
     return release_history.get(platform, {}).get(locale, {})
 
 
 def get_partials_artifacts(release_history, platform, locale):
     platform = _sanitize_platform(platform)
-    return release_history.get(platform, {}).get(locale, {}).keys()
+    return [
+        (artifact, details.get('previousVersion', None))
+        for artifact, details in release_history.get(platform, {}).get(locale, {}).items()
+    ]
 
 
 def get_partials_artifact_map(release_history, platform, locale):
     platform = _sanitize_platform(platform)
 
     artifact_map = {}
     for k in release_history.get(platform, {}).get(locale, {}):
         details = release_history[platform][locale][k]