Bug 1353333 - [push-apk] release: activate rollout percentage r=aki
☠☠ backed out by 1cf1b7333d98 ☠ ☠
authorJohan Lorenzo <jlorenzo@mozilla.com>
Thu, 06 Apr 2017 10:30:59 +0200
changeset 558343 ba97ba73f72d4e8a36e9e05400b5a3056624a43e
parent 558342 6d936a886de840f007e1f7b9dfa2469b48d5e673
child 558344 64f302609496bf4f1bf0b92b51b615bfa1ce4ccc
push id52860
push userbmo:walkingice0204@gmail.com
push dateFri, 07 Apr 2017 13:29:26 +0000
reviewersaki
bugs1353333
milestone55.0a1
Bug 1353333 - [push-apk] release: activate rollout percentage r=aki MozReview-Commit-ID: 6SXbfREPBVS
taskcluster/taskgraph/transforms/push_apk.py
taskcluster/taskgraph/transforms/task.py
taskcluster/taskgraph/util/scriptworker.py
--- a/taskcluster/taskgraph/transforms/push_apk.py
+++ b/taskcluster/taskgraph/transforms/push_apk.py
@@ -7,17 +7,17 @@ Transform the push-apk kind into an actu
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import functools
 
 from taskgraph.transforms.base import TransformSequence
 from taskgraph.util.schema import Schema
 from taskgraph.util.scriptworker import get_push_apk_scope, get_push_apk_track, \
-    get_push_apk_dry_run_option
+    get_push_apk_dry_run_option, get_push_apk_rollout_percentage
 from taskgraph.util.push_apk import fill_labels_tranform, validate_jobs_schema_transform_partial, \
     validate_dependent_tasks_transform, delete_non_required_fields_transform, generate_dependencies
 
 from voluptuous import Required
 
 
 transforms = TransformSequence()
 
@@ -49,16 +49,21 @@ transforms.add(validate_dependent_tasks_
 
 @transforms.add
 def make_task_description(config, jobs):
     for job in jobs:
         job['dependencies'] = generate_dependencies(job['dependent-tasks'])
         job['worker']['upstream-artifacts'] = generate_upstream_artifacts(job['dependencies'])
         job['worker']['google-play-track'] = get_push_apk_track(config)
         job['worker']['dry-run'] = get_push_apk_dry_run_option(config)
+
+        rollout_percentage = get_push_apk_rollout_percentage(config)
+        if rollout_percentage is not None:
+            job['worker']['rollout-percentage'] = rollout_percentage
+
         job['scopes'] = [get_push_apk_scope(config)]
 
         yield job
 
 
 transforms.add(delete_non_required_fields_transform)
 
 
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -362,16 +362,17 @@ task_description_schema = Schema({
 
             # Paths to the artifacts to sign
             Required('paths'): [basestring],
         }],
 
         # "Invalid" is a noop for try and other non-supported branches
         Required('google-play-track'): Any('production', 'beta', 'alpha', 'invalid'),
         Required('dry-run', default=True): bool,
+        Optional('rollout-percentage'): int,
     }),
 })
 
 GROUP_NAMES = {
     'py': 'Python unit tests',
     'tc': 'Executed by TaskCluster',
     'tc-e10s': 'Executed by TaskCluster with e10s',
     'tc-Fxfn-l': 'Firefox functional tests (local) executed by TaskCluster',
@@ -626,16 +627,19 @@ def build_push_apk_payload(config, task,
     worker = task['worker']
 
     task_def['payload'] = {
         'dry_run': worker['dry-run'],
         'upstreamArtifacts':  worker['upstream-artifacts'],
         'google_play_track': worker['google-play-track'],
     }
 
+    if worker.get('rollout-percentage', None):
+        task_def['payload']['rollout_percentage'] = worker['rollout-percentage']
+
 
 @payload_builder('push-apk-breakpoint')
 def build_push_apk_breakpoint_payload(config, task, task_def):
     task_def['payload'] = task['worker']['payload']
 
 
 @payload_builder('native-engine')
 def build_macosx_engine_payload(config, task, task_def):
--- a/taskcluster/taskgraph/util/scriptworker.py
+++ b/taskcluster/taskgraph/util/scriptworker.py
@@ -227,16 +227,21 @@ PUSH_APK_BREAKPOINT_WORKER_TYPE = {
 
 PUSH_APK_DRY_RUN_OPTION = {
     'aurora': False,
     'beta': False,
     'release': True,
     'default': True,
 }
 
+PUSH_APK_ROLLOUT_PERCENTAGE = {
+    'release': 10,
+    'default': None,
+}
+
 
 # scope functions {{{1
 def get_scope_from_project(alias_to_project_map, alias_to_scope_map, config):
     """Determine the restricted scope from `config.params['project']`.
 
     Args:
         alias_to_project_map (list of lists): each list pair contains the
             alias and the set of projects that match.  This is ordered.
@@ -350,16 +355,21 @@ get_push_apk_breakpoint_worker_type = fu
 )
 
 get_push_apk_dry_run_option = functools.partial(
     get_scope_from_project,
     PUSH_APK_SCOPE_ALIAS_TO_PROJECT,
     PUSH_APK_DRY_RUN_OPTION
 )
 
+get_push_apk_rollout_percentage = functools.partial(
+    get_scope_from_project,
+    PUSH_APK_SCOPE_ALIAS_TO_PROJECT,
+    PUSH_APK_ROLLOUT_PERCENTAGE
+)
 
 # release_config {{{1
 def get_release_config(config):
     """Get the build number and version for a release task.
 
     Currently only applies to beetmover tasks.
 
     Args: