Bug 1481121: [release] Rationalize beetmover_repacakge dependency names; r=Callek
authorTom Prince <mozilla@hocat.ca>
Fri, 17 Aug 2018 13:15:07 -0600
changeset 433944 d70b429fda86b2dd606454043bdd42fe7f7d4407
parent 433943 c832e6e8714145a51619fbcbdd562422c931e59f
child 433945 a702b39447f197ed7ec5d89416c6642505a5411d
push id34526
push useraiakab@mozilla.com
push dateWed, 29 Aug 2018 21:56:30 +0000
treeherdermozilla-central@2b50a2ad969a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCallek
bugs1481121
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1481121: [release] Rationalize beetmover_repacakge dependency names; r=Callek Differential Revision: https://phabricator.services.mozilla.com/D3812
taskcluster/taskgraph/transforms/beetmover_repackage.py
--- a/taskcluster/taskgraph/transforms/beetmover_repackage.py
+++ b/taskcluster/taskgraph/transforms/beetmover_repackage.py
@@ -209,52 +209,41 @@ def make_task_description(config, jobs):
             "Beetmover submission for locale '{locale}' for build '"
             "{build_platform}/{build_type}'".format(
                 locale=attributes.get('locale', 'en-US'),
                 build_platform=attributes.get('build_platform'),
                 build_type=attributes.get('build_type')
             )
         )
 
-        dependent_kind = str(dep_job.kind)
+        dependent_kind = dep_job.kind
+        if dependent_kind == 'repackage-signing-l10n':
+            dependent_kind = "repackage-signing"
         dependencies = {dependent_kind: dep_job.label}
 
         signing_name = "build-signing"
         if job.get('locale'):
             signing_name = "nightly-l10n-signing"
-        signing_dependencies = {signing_name:
-                                dep_job.dependencies[signing_name]
-                                }
-        dependencies.update(signing_dependencies)
+        dependencies['signing'] = dep_job.dependencies[signing_name]
 
         build_name = "build"
         if job.get('locale'):
             build_name = "unsigned-repack"
-        build_dependencies = {"build":
-                              dep_job.dependencies[build_name]
-                              }
-        dependencies.update(build_dependencies)
+        dependencies["build"] = dep_job.dependencies[build_name]
 
-        repackage_name = "repackage"
         # repackage-l10n actually uses the repackage depname here
-        repackage_dependencies = {"repackage":
-                                  dep_job.dependencies[repackage_name]
-                                  }
-        dependencies.update(repackage_dependencies)
+        dependencies["repackage"] = dep_job.dependencies["repackage"]
 
         # If this isn't a direct dependency, it won't be in there.
         if 'repackage-signing' not in dependencies and \
                 'repackage-signing-l10n' not in dependencies:
             repackage_signing_name = "repackage-signing"
             if job.get('locale'):
                 repackage_signing_name = "repackage-signing-l10n"
-            repackage_signing_deps = {"repackage-signing":
-                                      dep_job.dependencies[repackage_signing_name]
-                                      }
-            dependencies.update(repackage_signing_deps)
+            dependencies["repackage-signing"] = dep_job.dependencies[repackage_signing_name]
 
         attributes = copy_attributes_from_dependent_job(dep_job)
         if job.get('locale'):
             attributes['locale'] = job['locale']
 
         bucket_scope = get_beetmover_bucket_scope(config)
         action_scope = get_beetmover_action_scope(config)
         phase = get_phase(config)
@@ -270,76 +259,65 @@ def make_task_description(config, jobs):
             'treeherder': treeherder,
             'shipping-phase': job.get('shipping-phase', phase),
             'shipping-product': job.get('shipping-product'),
         }
 
         yield task
 
 
-def generate_upstream_artifacts(job, build_task_ref, build_signing_task_ref,
-                                repackage_task_ref, repackage_signing_task_ref,
-                                platform, locale=None, project=None):
+def generate_upstream_artifacts(job, platform, locale=None, project=None):
 
     build_mapping = UPSTREAM_ARTIFACT_UNSIGNED_PATHS
     build_signing_mapping = UPSTREAM_ARTIFACT_SIGNED_PATHS
     repackage_mapping = UPSTREAM_ARTIFACT_REPACKAGE_PATHS
     repackage_signing_mapping = UPSTREAM_ARTIFACT_SIGNED_REPACKAGE_PATHS
 
     artifact_prefix = get_artifact_prefix(job)
     if locale:
         artifact_prefix = '{}/{}'.format(artifact_prefix, locale)
         platform = "{}-l10n".format(platform)
 
     upstream_artifacts = []
 
-    task_refs = [
-        build_task_ref,
-        build_signing_task_ref,
-        repackage_task_ref,
-        repackage_signing_task_ref
-    ]
-    tasktypes = ['build', 'signing', 'repackage', 'repackage']
-    mapping = [
-        build_mapping,
-        build_signing_mapping,
-        repackage_mapping,
-        repackage_signing_mapping
-    ]
-
-    for ref, tasktype, mapping in zip(task_refs, tasktypes, mapping):
+    for task_type, cot_type, mapping in [
+        ("build", "build", build_mapping),
+        ("signing", "signing", build_signing_mapping),
+        ('repackage', 'repackage', repackage_mapping),
+        ('repackage-signing', 'repackage', repackage_signing_mapping),
+    ]:
         platform_was_previously_matched_by_regex = None
         for platform_regex, paths in mapping.iteritems():
             if platform_regex.match(platform) is not None:
                 _check_platform_matched_only_one_regex(
-                    tasktype, platform, platform_was_previously_matched_by_regex, platform_regex
+                    task_type, platform, platform_was_previously_matched_by_regex, platform_regex
                 )
+                platform_was_previously_matched_by_regex = platform_regex
                 if paths:
                     usable_paths = paths[:]
 
                     use_stub = job["attributes"].get('stub-installer')
                     if not use_stub:
                         if 'target.stub-installer.exe' in usable_paths:
                             usable_paths.remove('target.stub-installer.exe')
                     if 'target.langpack.xpi' in usable_paths and \
                             not project == "mozilla-central":
                         # XXX This is only beetmoved for m-c nightlies.
                         # we should determine this better
                         usable_paths.remove('target.langpack.xpi')
                         if not len(usable_paths):
                             # We may have removed our only path.
                             continue
                     upstream_artifacts.append({
-                        "taskId": {"task-reference": ref},
-                        "taskType": tasktype,
+                        "taskId": {"task-reference": "<{}>".format(task_type)},
+                        "taskType": cot_type,
                         "paths": ["{}/{}".format(artifact_prefix, path)
                                   for path in usable_paths],
                         "locale": locale or "en-US",
                     })
-                platform_was_previously_matched_by_regex = platform_regex
 
     return upstream_artifacts
 
 
 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)
@@ -386,45 +364,26 @@ def make_task_worker(config, jobs):
     for job in jobs:
         if not is_valid_beetmover_job(job):
             raise NotImplementedError(
                 "{}: Beetmover_repackage must have five dependencies.".format(job['label'])
             )
 
         locale = job["attributes"].get("locale")
         platform = job["attributes"]["build_platform"]
-        build_task = None
-        build_signing_task = None
-        repackage_task = None
-        repackage_signing_task = None
 
-        for dependency in job["dependencies"].keys():
-            if 'repackage-signing' in dependency:
-                repackage_signing_task = dependency
-            elif 'repackage' in dependency:
-                repackage_task = dependency
-            elif 'signing' in dependency:
-                # catches build-signing and nightly-l10n-signing
-                build_signing_task = dependency
-            else:
-                build_task = "build"
-
-        build_task_ref = "<" + str(build_task) + ">"
-        build_signing_task_ref = "<" + str(build_signing_task) + ">"
-        repackage_task_ref = "<" + str(repackage_task) + ">"
-        repackage_signing_task_ref = "<" + str(repackage_signing_task) + ">"
+        upstream_artifacts = generate_upstream_artifacts(
+            job, platform, locale,
+            project=config.params['project']
+        )
 
         worker = {
             'implementation': 'beetmover',
             'release-properties': craft_release_properties(config, job),
-            'upstream-artifacts': generate_upstream_artifacts(
-                job, build_task_ref, build_signing_task_ref, repackage_task_ref,
-                repackage_signing_task_ref, platform, locale,
-                project=config.params['project']
-            ),
+            'upstream-artifacts': upstream_artifacts,
         }
         if locale:
             worker["locale"] = locale
         job["worker"] = worker
 
         yield job