Bug 1458700: [release-promotion] Move configuration of version-bump and partial-update flavors to graph config; r=aki
authorTom Prince <mozilla@hocat.ca>
Wed, 30 May 2018 07:16:41 +0000
changeset 420499 5391b20d3f00d0c121e3d07bfcfdf4b595a844e5
parent 420498 e9a9f3abd88935b5d4106a53d15d956ab2870ac4
child 420500 8b72e1dcd91757570b00187e0811506019b1f3b4
push id103828
push useraiakab@mozilla.com
push dateWed, 30 May 2018 22:08:58 +0000
treeherdermozilla-inbound@8d0ee6e73fb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaki
bugs1458700
milestone62.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 1458700: [release-promotion] Move configuration of version-bump and partial-update flavors to graph config; r=aki Differential Revision: https://phabricator.services.mozilla.com/D1452
taskcluster/ci/config.yml
taskcluster/taskgraph/actions/release_promotion.py
taskcluster/taskgraph/config.py
--- a/taskcluster/ci/config.yml
+++ b/taskcluster/ci/config.yml
@@ -112,59 +112,70 @@ release-promotion:
     products:
         - 'devedition'
         - 'fennec'
         - 'firefox'
     flavors:
         promote_devedition:
             product: devedition
             target-tasks-method: promote_desktop
+            partial-updates: true
         promote_fennec:
             product: fennec
             target-tasks-method: promote_fennec
         promote_firefox:
             product: firefox
             target-tasks-method: promote_desktop
+            partial-updates: true
         promote_firefox_partners:
             product: firefox
             rebuild-kinds:
                 - release-partner-repack
                 - release-partner-beetmover
                 - release-partner-repack-chunking-dummy
                 - release-partner-repackage-signing
                 - release-partner-repackage
                 - release-partner-signing
             target-tasks-method: promote_desktop
         promote_firefox_rc:
             product: firefox
             release-type: rc
             target-tasks-method: promote_desktop
+            partial-updates: true
         push_devedition:
             product: devedition
             target-tasks-method: push_desktop
+            partial-updates: true
         push_firefox:
             product: firefox
             target-tasks-method: push_desktop
+            partial-updates: true
         ship_devedition:
             product: devedition
             target-tasks-method: ship_desktop
+            version-bump: true
+            partial-updates: true
         ship_fennec:
             product: fennec
             target-tasks-method: ship_fennec
+            version-bump: true
         ship_fennec_rc:
             product: fennec
             release-type: rc
             target-tasks-method: ship_fennec
         ship_firefox:
             product: firefox
             target-tasks-method: ship_desktop
+            version-bump: true
+            partial-updates: true
         ship_firefox_rc:
             product: firefox
             release-type: rc
             target-tasks-method: ship_desktop
+            partial-updates: true
 
 scriptworker:
     # See additional configuration in taskcluster/taskgraph/util/scriptworker.py
     scope-prefix: 'project:releng'
     worker-types:
         'scriptworker-prov-v1/signing-linux-v1':
             - 'project:releng:signing:cert:release-signing'
             - 'project:releng:signing:cert:nightly-signing'
--- a/taskcluster/taskgraph/actions/release_promotion.py
+++ b/taskcluster/taskgraph/actions/release_promotion.py
@@ -24,46 +24,38 @@ from taskgraph.util.partners import (
     get_token
 )
 from taskgraph.taskgraph import TaskGraph
 from taskgraph.decision import taskgraph_decision
 from taskgraph.parameters import Parameters
 from taskgraph.util.attributes import RELEASE_PROMOTION_PROJECTS
 
 
-VERSION_BUMP_FLAVORS = (
-    'ship_fennec',
-    'ship_firefox',
-    'ship_devedition',
-)
-
-PARTIAL_UPDATES_FLAVORS = (
-    'promote_firefox',
-    'promote_firefox_rc',
-    'promote_devedition',
-    'push_firefox',
-    'push_firefox_rc',
-    'push_devedition',
-    'ship_firefox',
-    'ship_firefox_rc',
-    'ship_devedition',
-)
-
-
 def is_release_promotion_available(parameters):
     return parameters['project'] in RELEASE_PROMOTION_PROJECTS
 
 
 def get_partner_config(partner_url_config, github_token):
     partner_config = {}
     for kind, url in partner_url_config.items():
         partner_config[kind] = get_partner_config_by_url(url, kind, github_token)
     return partner_config
 
 
+def get_flavors(graph_config, param):
+    """
+    Get all flavors with the given parameter enabled.
+    """
+    promotion_flavors = graph_config['release-promotion']['flavors']
+    return sorted([
+        flavor for (flavor, config) in promotion_flavors.items()
+        if config.get(param, False)
+    ])
+
+
 @register_callback_action(
     name='release-promotion',
     title='Release Promotion',
     symbol='${input.release_promotion_flavor}',
     description="Promote a release.",
     order=10000,
     context=[],
     available=is_release_promotion_available,
@@ -124,17 +116,17 @@ def get_partner_config(partner_url_confi
                                 'commit, but want to act on a build from a previous '
                                 'commit. If a version bump has landed in the meantime, '
                                 'relying on the in-tree version will break things.'),
                 'default': '',
             },
             'next_version': {
                 'type': 'string',
                 'description': ('Next version. Required in the following flavors: '
-                                '{}'.format(sorted(VERSION_BUMP_FLAVORS))),
+                                '{}'.format(get_flavors(graph_config, 'version-bump'))),
                 'default': '',
             },
 
             # Example:
             #   'partial_updates': {
             #       '38.0': {
             #           'buildNumber': 1,
             #           'locales': ['de', 'en-GB', 'ru', 'uk', 'zh-TW']
@@ -142,17 +134,17 @@ def get_partner_config(partner_url_confi
             #       '37.0': {
             #           'buildNumber': 2,
             #           'locales': ['de', 'en-GB', 'ru', 'uk']
             #       }
             #   }
             'partial_updates': {
                 'type': 'object',
                 'description': ('Partial updates. Required in the following flavors: '
-                                '{}'.format(sorted(PARTIAL_UPDATES_FLAVORS))),
+                                '{}'.format(get_flavors(graph_config, 'partial-updates'))),
                 'default': {},
                 'additionalProperties': {
                     'type': 'object',
                     'properties': {
                         'buildNumber': {
                             'type': 'number',
                         },
                         'locales': {
@@ -211,38 +203,37 @@ def get_partner_config(partner_url_confi
 )
 def release_promotion_action(parameters, graph_config, input, task_group_id, task_id, task):
     release_promotion_flavor = input['release_promotion_flavor']
     promotion_config = graph_config['release-promotion']['flavors'][release_promotion_flavor]
     release_history = {}
     product = promotion_config['product']
 
     next_version = str(input.get('next_version') or '')
-    if release_promotion_flavor in VERSION_BUMP_FLAVORS:
+    if promotion_config.get('version-bump', False):
         # We force str() the input, hence the 'None'
         if next_version in ['', 'None']:
             raise Exception(
-                "`next_version` property needs to be provided for %s "
-                "targets." % ', '.join(VERSION_BUMP_FLAVORS)
+                "`next_version` property needs to be provided for `{}` "
+                "target.".format(release_promotion_flavor)
             )
 
-    if product in ('firefox', 'devedition'):
-        if release_promotion_flavor in PARTIAL_UPDATES_FLAVORS:
-            partial_updates = json.dumps(input.get('partial_updates', {}))
-            if partial_updates == "{}":
-                raise Exception(
-                    "`partial_updates` property needs to be provided for %s "
-                    "targets." % ', '.join(PARTIAL_UPDATES_FLAVORS)
-                )
-            balrog_prefix = product.title()
-            os.environ['PARTIAL_UPDATES'] = partial_updates
-            release_history = populate_release_history(
-                balrog_prefix, parameters['project'],
-                partial_updates=input['partial_updates']
+    if promotion_config.get('partial-updates', False):
+        partial_updates = json.dumps(input.get('partial_updates', {}))
+        if partial_updates == "{}":
+            raise Exception(
+                "`partial_updates` property needs to be provided for `{}`"
+                "target.".format(release_promotion_flavor)
             )
+        balrog_prefix = product.title()
+        os.environ['PARTIAL_UPDATES'] = partial_updates
+        release_history = populate_release_history(
+            balrog_prefix, parameters['project'],
+            partial_updates=input['partial_updates']
+        )
 
     target_tasks_method = promotion_config['target-tasks-method'].format(
         project=parameters['project']
     )
     rebuild_kinds = input.get(
         'rebuild_kinds', promotion_config.get('rebuild-kinds', [])
     )
     do_not_optimize = input.get(
--- a/taskcluster/taskgraph/config.py
+++ b/taskcluster/taskgraph/config.py
@@ -40,16 +40,18 @@ graph_config_schema = Schema({
     },
     Required('release-promotion'): {
         Required('products'): [basestring],
         Required('flavors'): {basestring: {
             Required('product'): basestring,
             Required('target-tasks-method'): basestring,
             Optional('release-type'): basestring,
             Optional('rebuild-kinds'): [basestring],
+            Optional('version-bump'): bool,
+            Optional('partial-updates'): bool,
         }},
     },
     Required('scriptworker'): {
         # Prefix to add to scopes controlling scriptworkers
         Required('scope-prefix'): basestring,
         # Mapping of scriptworker types to scopes they accept
         Required('worker-types'): {basestring: [basestring]}
     },