Bug 1412836 - Use dep-pushapk scritpworker for non m-c, m-b, m-r branches r=aki draft
authorJohan Lorenzo <jlorenzo@mozilla.com>
Tue, 28 Nov 2017 13:11:07 +0100
changeset 704236 bad4de8cb6689875488e6be2ae6043e7c1058a38
parent 704194 5b33b070378ae0806bed0b5e5e34de429a29e7db
child 742044 aa5cad9614df29d2e1c5799b13285441839c283e
push id91123
push userbmo:jlorenzo@mozilla.com
push dateTue, 28 Nov 2017 12:11:46 +0000
reviewersaki
bugs1412836
milestone59.0a1
Bug 1412836 - Use dep-pushapk scritpworker for non m-c, m-b, m-r branches r=aki MozReview-Commit-ID: 8aGonUxppxq
taskcluster/ci/push-apk/kind.yml
taskcluster/taskgraph/transforms/push_apk.py
taskcluster/taskgraph/transforms/task.py
taskcluster/taskgraph/util/scriptworker.py
--- a/taskcluster/ci/push-apk/kind.yml
+++ b/taskcluster/ci/push-apk/kind.yml
@@ -15,22 +15,27 @@ kind-dependencies:
 jobs:
     push-apk/opt:
         description: Publishes APK onto Google Play Store
         attributes:
             build_platform: android-nightly
             nightly: true
         shipping-phase: ship
         shipping-product: fennec
-        worker-type: scriptworker-prov-v1/pushapk-v1
+        worker-type:
+            by-project:
+                mozilla-central: scriptworker-prov-v1/pushapk-v1
+                mozilla-beta: scriptworker-prov-v1/pushapk-v1
+                mozilla-release: scriptworker-prov-v1/pushapk-v1
+                default: scriptworker-prov-v1/dep-pushapk
         worker:
             upstream-artifacts:  # see transforms
             google-play-track:  # see transforms
             implementation: push-apk
-            dry-run:  # see transforms
+            commit:  # see transforms
         scopes:  # see transforms
         treeherder:
             symbol: pub(gp)
             platform: Android/opt
             tier: 2
             kind: other
         run-on-projects: ['mozilla-central', 'mozilla-beta', 'mozilla-release']
         deadline-after: 5 days
--- a/taskcluster/taskgraph/transforms/push_apk.py
+++ b/taskcluster/taskgraph/transforms/push_apk.py
@@ -6,19 +6,19 @@ 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.transforms.task import task_description_schema
-from taskgraph.util.schema import Schema
+from taskgraph.util.schema import optionally_keyed_by, resolve_keyed_by, Schema
 from taskgraph.util.scriptworker import get_push_apk_scope, get_push_apk_track, \
-    get_push_apk_dry_run_option, get_push_apk_rollout_percentage
+    get_push_apk_commit_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 Optional, Required
 
 
 transforms = TransformSequence()
 
@@ -32,17 +32,17 @@ push_apk_description_schema = Schema({
     Required('dependent-tasks'): object,
     Required('name'): basestring,
     Required('label'): basestring,
     Required('description'): basestring,
     Required('job-from'): basestring,
     Required('attributes'): object,
     Required('treeherder'): object,
     Required('run-on-projects'): list,
-    Required('worker-type'): basestring,
+    Required('worker-type'): optionally_keyed_by('project', basestring),
     Required('worker'): object,
     Required('scopes'): None,
     Required('deadline-after'): basestring,
     Required('shipping-phase'): task_description_schema['shipping-phase'],
     Required('shipping-product'): task_description_schema['shipping-product'],
     Optional('extra'): object,
 })
 
@@ -58,24 +58,29 @@ 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)
+        job['worker']['commit'] = get_push_apk_commit_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)]
 
+        resolve_keyed_by(
+            job, 'worker-type', item_name=job['name'],
+            project=config.params['project']
+        )
+
         yield job
 
 
 transforms.add(delete_non_required_fields_transform)
 
 
 def generate_upstream_artifacts(dependencies):
     return [{
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -548,17 +548,17 @@ task_description_schema = Schema({
             Required('taskType'): basestring,
 
             # 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', 'rollout', 'invalid'),
-        Required('dry-run', default=True): bool,
+        Required('commit', default=False): bool,
         Optional('rollout-percentage'): int,
     }),
 })
 
 TC_TREEHERDER_SCHEMA_URL = 'https://github.com/taskcluster/taskcluster-treeherder/' \
                            'blob/master/schemas/task-treeherder-config.yml'
 
 
@@ -984,17 +984,17 @@ def build_balrog_payload(config, task, t
     }
 
 
 @payload_builder('push-apk')
 def build_push_apk_payload(config, task, task_def):
     worker = task['worker']
 
     task_def['payload'] = {
-        'dry_run': worker['dry-run'],
+        'commit': worker['commit'],
         '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']
 
 
--- a/taskcluster/taskgraph/util/scriptworker.py
+++ b/taskcluster/taskgraph/util/scriptworker.py
@@ -248,22 +248,22 @@ PUSH_APK_GOOGLE_PLAY_TRACT = {
 PUSH_APK_BREAKPOINT_WORKER_TYPE = {
     'central': 'aws-provisioner-v1/taskcluster-generic',
     'beta': 'null-provisioner/human-breakpoint',
     'release': 'null-provisioner/human-breakpoint',
     'maple': 'aws-provisioner-v1/taskcluster-generic',
     'default': 'invalid/invalid',
 }
 
-PUSH_APK_DRY_RUN_OPTION = {
-    'central': False,
-    'beta': False,
-    'maple': True,
-    'release': False,
-    'default': True,
+PUSH_APK_COMMIT_OPTION = {
+    'central': True,
+    'beta': True,
+    'maple': False,
+    'release': True,
+    'default': False,
 }
 
 PUSH_APK_ROLLOUT_PERCENTAGE = {
     # XXX Please make sure to change PUSH_APK_GOOGLE_PLAY_TRACT to 'rollout' if you add a new
     # supported project
     'release': 10,
     'beta': 10,
     'default': None,
@@ -387,20 +387,20 @@ get_push_apk_track = functools.partial(
 )
 
 get_push_apk_breakpoint_worker_type = functools.partial(
     get_scope_from_project,
     PUSH_APK_SCOPE_ALIAS_TO_PROJECT,
     PUSH_APK_BREAKPOINT_WORKER_TYPE
 )
 
-get_push_apk_dry_run_option = functools.partial(
+get_push_apk_commit_option = functools.partial(
     get_scope_from_project,
     PUSH_APK_SCOPE_ALIAS_TO_PROJECT,
-    PUSH_APK_DRY_RUN_OPTION
+    PUSH_APK_COMMIT_OPTION
 )
 
 get_push_apk_rollout_percentage = functools.partial(
     get_scope_from_project,
     PUSH_APK_SCOPE_ALIAS_TO_PROJECT,
     PUSH_APK_ROLLOUT_PERCENTAGE
 )