Bug 1498019: [release] Don't handle beetmover scopes by target task; r=aki
authorTom Prince <mozilla@hocat.ca>
Thu, 11 Oct 2018 04:23:52 +0000
changeset 499124 7e16cc9af2ba6b6d4f7b16e61528071dddb3d7e2
parent 499123 f970ec1fd69621a6e7eba9bb5fa41fa413c7fdb9
child 499125 70d26c3920b819b539a7b6e0e87f128d27395311
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaki
bugs1498019
milestone64.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 1498019: [release] Don't handle beetmover scopes by target task; r=aki - `beetmover-cdns` should always use `:beetmover:action:push-to-releases`, not every task that happens to be part of the push graph. - All other beetmover scopes only change depending whether the builds is a nightly build, or on a production branch. Differential Revision: https://phabricator.services.mozilla.com/D8304
taskcluster/taskgraph/transforms/beetmover_push_to_release.py
taskcluster/taskgraph/util/scriptworker.py
--- a/taskcluster/taskgraph/transforms/beetmover_push_to_release.py
+++ b/taskcluster/taskgraph/transforms/beetmover_push_to_release.py
@@ -7,17 +7,17 @@ Transform the beetmover-push-to-release 
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 from taskgraph.transforms.base import TransformSequence
 from taskgraph.util.schema import (
      validate_schema, Schema,
 )
 from taskgraph.util.scriptworker import (
-    get_beetmover_bucket_scope, get_beetmover_action_scope,
+    get_beetmover_bucket_scope, add_scope_prefix,
     get_worker_type_for_scope,
 )
 from taskgraph.transforms.job import job_description_schema
 from taskgraph.transforms.task import task_description_schema
 from voluptuous import Any, Required, Optional
 
 # Voluptuous uses marker objects as dictionary *keys*, but they are not
 # comparable, so we cast all of the keys back to regular strings
@@ -69,17 +69,17 @@ def make_beetmover_push_to_release_descr
         label = job['name']
         description = (
             "Beetmover push to release for '{product}'".format(
                 product=job['product']
             )
         )
 
         bucket_scope = get_beetmover_bucket_scope(config)
-        action_scope = get_beetmover_action_scope(config)
+        action_scope = add_scope_prefix(config, 'beetmover:action:push-to-releases')
 
         task = {
             'label': label,
             'description': description,
             'worker-type': get_worker_type_for_scope(config, bucket_scope),
             'scopes': [bucket_scope, action_scope],
             'product': job['product'],
             'dependencies': job['dependencies'],
--- a/taskcluster/taskgraph/util/scriptworker.py
+++ b/taskcluster/taskgraph/util/scriptworker.py
@@ -71,90 +71,41 @@ DEVEDITION_SIGNING_CERT_SCOPES = {
     'default': 'signing:cert:dep-signing',
 }
 
 """Map beetmover scope aliases to sets of projects.
 """
 BEETMOVER_SCOPE_ALIAS_TO_PROJECT = [[
     'all-nightly-branches', set([
         'mozilla-central',
-        'mozilla-beta',
-        'mozilla-release',
-        'mozilla-esr60',
         'comm-central',
     ])
 ], [
     'all-release-branches', set([
         'mozilla-beta',
         'mozilla-release',
         'mozilla-esr60',
         'comm-beta',
         'comm-esr60',
     ])
 ]]
 
-"""The set of all beetmover release target tasks.
-
-Used for both `BEETMOVER_SCOPE_ALIAS_TO_TARGET_TASK` and `get_release_build_number`
-"""
-BEETMOVER_CANDIDATES_TARGET_TASKS = set([
-    'promote_fennec',
-    'promote_desktop',
-])
-BEETMOVER_PUSH_TARGET_TASKS = set([
-    'push_fennec',
-    'ship_fennec',
-    'push_desktop',
-    'ship_desktop',
-])
-BEETMOVER_RELEASE_TARGET_TASKS = BEETMOVER_CANDIDATES_TARGET_TASKS | BEETMOVER_PUSH_TARGET_TASKS
-
-"""Map beetmover tasks aliases to sets of target task methods.
-
-This is a list of list-pairs, for ordering.
-"""
-BEETMOVER_SCOPE_ALIAS_TO_TARGET_TASK = [[
-    'all-nightly-tasks', set([
-        'nightly_fennec',
-        'nightly_linux',
-        'nightly_macosx',
-        'nightly_win32',
-        'nightly_win64',
-        'nightly_desktop',
-        'mozilla_beta_tasks',
-        'mozilla_release_tasks',
-    ])
-], [
-    'all-candidates-tasks', BEETMOVER_CANDIDATES_TARGET_TASKS
-], [
-    'all-push-tasks', BEETMOVER_PUSH_TARGET_TASKS
-]]
-
 """Map the beetmover scope aliases to the actual scopes.
 """
 BEETMOVER_BUCKET_SCOPES = {
-    'all-candidates-tasks': {
-        'all-release-branches': 'beetmover:bucket:release',
-    },
-    'all-push-tasks': {
-        'all-release-branches': 'beetmover:bucket:release',
-    },
-    'all-nightly-tasks': {
-        'all-nightly-branches': 'beetmover:bucket:nightly',
-    },
+    'all-release-branches': 'beetmover:bucket:release',
+    'all-nightly-branches': 'beetmover:bucket:nightly',
     'default': 'beetmover:bucket:dep',
 }
 
 """Map the beetmover tasks aliases to the actual action scopes.
 """
 BEETMOVER_ACTION_SCOPES = {
-    'all-candidates-tasks': 'beetmover:action:push-to-candidates',
-    'all-push-tasks': 'beetmover:action:push-to-releases',
-    'all-nightly-tasks': 'beetmover:action:push-to-nightly',
-    'default': 'beetmover:action:push-to-nightly',
+    'nightly': 'beetmover:action:push-to-nightly',
+    'default': 'beetmover:action:push-to-candidates',
 }
 
 
 """Known balrog actions."""
 BALROG_ACTIONS = ('submit-locale', 'submit-toplevel', 'schedule')
 
 """Map balrog scope aliases to sets of projects.
 
@@ -283,63 +234,30 @@ def get_scope_from_project(config, alias
     """
     for alias, projects in alias_to_project_map:
         if config.params['project'] in projects and alias in alias_to_scope_map:
             return alias_to_scope_map[alias]
     return alias_to_scope_map['default']
 
 
 @with_scope_prefix
-def get_scope_from_target_method(config, alias_to_tasks_map, alias_to_scope_map):
+def get_scope_from_release_type(config, release_type_to_scope_map):
     """Determine the restricted scope from `config.params['target_tasks_method']`.
 
     Args:
         config (TransformConfig): The configuration for the kind being transformed.
-        alias_to_tasks_map (list of lists): each list pair contains the
-            alias and the set of target methods that match. This is ordered.
-        alias_to_scope_map (dict): the alias alias to scope
+        release_type_to_scope_map (dict): the maps release types to scopes
 
     Returns:
         string: the scope to use.
     """
-    for alias, tasks in alias_to_tasks_map:
-        if config.params['target_tasks_method'] in tasks and alias in alias_to_scope_map:
-            return alias_to_scope_map[alias]
-    return alias_to_scope_map['default']
-
-
-@with_scope_prefix
-def get_scope_from_target_method_and_project(config, alias_to_tasks_map,
-                                             alias_to_project_map, aliases_to_scope_map):
-    """Determine the restricted scope from both `target_tasks_method` and `project`.
-
-    On certain branches, we'll need differing restricted scopes based on
-    `target_tasks_method`.  However, we can't key solely on that, since that
-    `target_tasks_method` might be run on an unprivileged branch.  This method
-    checks both.
-
-    Args:
-        config (TransformConfig): The configuration for the kind being transformed.
-        alias_to_tasks_map (list of lists): each list pair contains the
-            alias and the set of target methods that match. This is ordered.
-        alias_to_project_map (list of lists): each list pair contains the
-            alias and the set of projects that match.  This is ordered.
-        aliases_to_scope_map (dict of dicts): the task alias to project alias to scope
-
-    Returns:
-        string: the scope to use.
-    """
-    project = config.params['project']
-    target = config.params['target_tasks_method']
-    for alias1, tasks in alias_to_tasks_map:
-        for alias2, projects in alias_to_project_map:
-            if target in tasks and project in projects and \
-                    aliases_to_scope_map.get(alias1, {}).get(alias2):
-                return aliases_to_scope_map[alias1][alias2]
-    return aliases_to_scope_map['default']
+    return release_type_to_scope_map.get(
+        config.params['release_type'],
+        release_type_to_scope_map['default']
+    )
 
 
 def get_phase_from_target_method(config, alias_to_tasks_map, alias_to_phase_map):
     """Determine the phase from `config.params['target_tasks_method']`.
 
     Args:
         config (TransformConfig): The configuration for the kind being transformed.
         alias_to_tasks_map (list of lists): each list pair contains the
@@ -369,26 +287,24 @@ get_signing_cert_scope = functools.parti
 
 get_devedition_signing_cert_scope = functools.partial(
     get_scope_from_project,
     alias_to_project_map=DEVEDITION_SIGNING_SCOPE_ALIAS_TO_PROJECT,
     alias_to_scope_map=DEVEDITION_SIGNING_CERT_SCOPES,
 )
 
 get_beetmover_bucket_scope = functools.partial(
-    get_scope_from_target_method_and_project,
-    alias_to_tasks_map=BEETMOVER_SCOPE_ALIAS_TO_TARGET_TASK,
+    get_scope_from_project,
     alias_to_project_map=BEETMOVER_SCOPE_ALIAS_TO_PROJECT,
-    aliases_to_scope_map=BEETMOVER_BUCKET_SCOPES,
+    alias_to_scope_map=BEETMOVER_BUCKET_SCOPES,
 )
 
 get_beetmover_action_scope = functools.partial(
-    get_scope_from_target_method,
-    alias_to_tasks_map=BEETMOVER_SCOPE_ALIAS_TO_TARGET_TASK,
-    alias_to_scope_map=BEETMOVER_ACTION_SCOPES,
+    get_scope_from_release_type,
+    release_type_to_scope_map=BEETMOVER_ACTION_SCOPES,
 )
 
 get_balrog_server_scope = functools.partial(
     get_scope_from_project,
     alias_to_project_map=BALROG_SCOPE_ALIAS_TO_PROJECT,
     alias_to_scope_map=BALROG_SERVER_SCOPES,
 )