bug 1415391 - move bbb properties under worker: r=dustin draft
authorAki Sasaki <asasaki@mozilla.com>
Wed, 08 Nov 2017 12:15:18 -0800
changeset 696440 f18c00e3b43cc2fff9ff8d31dcdcf61e977bf6cc
parent 696439 a0a37dfd4120597dda198aa5aa1fee59c1026835
child 696441 9c7b6beb13b676a3376a897f2c8143cc042b8276
push id88718
push userasasaki@mozilla.com
push dateFri, 10 Nov 2017 18:37:03 +0000
reviewersdustin
bugs1415391, 1412690
milestone58.0a1
bug 1415391 - move bbb properties under worker: r=dustin Per review comments in bug 1412690, this patch moves the `properties` definition under `worker:`, and resolves the `tuxedo_server_url` in the buildbot-bridge `payload_builder`. This addresses [1] and [2]. [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1412690#c52 [2] https://bugzilla.mozilla.org/show_bug.cgi?id=1412690#c54 MozReview-Commit-ID: JFAWr9Dk0gc
taskcluster/ci/release-bouncer-aliases/kind.yml
taskcluster/ci/release-uptake-monitoring/kind.yml
taskcluster/taskgraph/transforms/job/buildbot.py
taskcluster/taskgraph/transforms/task.py
--- a/taskcluster/ci/release-bouncer-aliases/kind.yml
+++ b/taskcluster/ci/release-bouncer-aliases/kind.yml
@@ -18,16 +18,17 @@ jobs:
       description: Update bouncer aliases job
       worker-type: buildbot-bridge/buildbot-bridge
       run-on-projects: []
       run:
          using: buildbot
          product: fennec
          buildername: release-{branch}-fennec_bouncer_aliases
          release-promotion: true
+      worker:
          properties:
              tuxedo_server_url:
                 by-project:
                     mozilla-beta: https://bounceradmin.mozilla.com/api
                     mozilla-release: https://bounceradmin.mozilla.com/api
                     maple: https://admin-bouncer.stage.mozaws.net/api/
                     default: http://localhost/api
       routes:
--- a/taskcluster/ci/release-uptake-monitoring/kind.yml
+++ b/taskcluster/ci/release-uptake-monitoring/kind.yml
@@ -18,25 +18,26 @@ jobs:
       description: Uptake monitoring job
       worker-type: buildbot-bridge/buildbot-bridge
       run-on-projects: []
       run:
          using: buildbot
          product: fennec
          buildername: release-{branch}-fennec_uptake_monitoring
          release-promotion: true
+      worker:
          properties:
-             # TODO: Calculate "platforms" dynamically
-             platforms: "android-api-16, android-x86"
-             tuxedo_server_url:
-                by-project:
-                    mozilla-beta: https://bounceradmin.mozilla.com/api
-                    mozilla-release: https://bounceradmin.mozilla.com/api
-                    maple: https://admin-bouncer.stage.mozaws.net/api/
-                    default: http://localhost/api
+            # TODO: Calculate "platforms" dynamically
+            platforms: "android-api-16, android-x86"
+            tuxedo_server_url:
+               by-project:
+                  mozilla-beta: https://bounceradmin.mozilla.com/api
+                  mozilla-release: https://bounceradmin.mozilla.com/api
+                  maple: https://admin-bouncer.stage.mozaws.net/api/
+                  default: http://localhost/api
       routes:
          - index.releases.v1.{branch}.latest.fennec.latest.uptake_monitoring
          - index.releases.v1.{branch}.{revision}.fennec.{underscore_version}.build{build_number}.uptake_monitoring
       index:
          type: release
          product: fennec
          job-name: android-api-16-opt
       notifications:
--- a/taskcluster/taskgraph/transforms/job/buildbot.py
+++ b/taskcluster/taskgraph/transforms/job/buildbot.py
@@ -3,21 +3,20 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 """
 
 Support for running jobs via buildbot.
 
 """
 
 from __future__ import absolute_import, print_function, unicode_literals
-import copy
 import slugid
 from urlparse import urlparse
 
-from taskgraph.util.schema import Schema, optionally_keyed_by, resolve_keyed_by
+from taskgraph.util.schema import Schema
 from taskgraph.util.scriptworker import get_release_config
 from voluptuous import Optional, Required, Any
 
 from taskgraph.transforms.job import run_job_using
 
 
 buildbot_run_schema = Schema({
     Required('using'): 'buildbot',
@@ -25,17 +24,16 @@ buildbot_run_schema = Schema({
     # the buildername to use for buildbot-bridge, will expand {branch} in name from
     # the current project.
     Required('buildername'): basestring,
 
     # the product to use
     Required('product'): Any('firefox', 'mobile', 'fennec', 'devedition', 'thunderbird'),
 
     Optional('release-promotion'): bool,
-    Optional('properties'): {basestring: optionally_keyed_by('project', basestring)},
 })
 
 
 def bb_release_worker(config, worker, run):
     # props
     release_props = get_release_config(config, force=True)
     repo_path = urlparse(config.params['head_repository']).path.lstrip('/')
     revision = config.params['head_rev']
@@ -52,41 +50,30 @@ def bb_ci_worker(config, worker):
     worker['properties'].update({
         'who': config.params['owner'],
         'upload_to_task_id': slugid.nice(),
     })
 
 
 @run_job_using('buildbot-bridge', 'buildbot', schema=buildbot_run_schema)
 def mozharness_on_buildbot_bridge(config, job, taskdesc):
-    # resolve by-* keys first
-    fields = [
-        "run.properties.tuxedo_server_url",
-    ]
-    job = copy.deepcopy(job)
-    for field in fields:
-        resolve_keyed_by(job, field, field, **config.params)
     run = job['run']
     worker = taskdesc['worker']
     branch = config.params['project']
     product = run['product']
 
     buildername = run['buildername'].format(branch=branch)
     revision = config.params['head_rev']
 
     worker.update({
         'buildername': buildername,
         'sourcestamp': {
             'branch': branch,
             'repository': config.params['head_repository'],
             'revision': revision,
         },
-        'properties': {
-            'product': product,
-        },
     })
-    if run.get('properties'):
-        worker['properties'].update(run['properties'])
+    worker.setdefault('properties', {})['product'] = product
 
     if run.get('release-promotion'):
         bb_release_worker(config, worker, run)
     else:
         bb_ci_worker(config, worker)
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -1003,16 +1003,23 @@ def build_macosx_engine_payload(config, 
         raise Exception('needs-sccache not supported in native-engine')
 
 
 @payload_builder('buildbot-bridge')
 def build_buildbot_bridge_payload(config, task, task_def):
     task['extra'].pop('treeherder', None)
     task['extra'].pop('treeherderEnv', None)
     worker = task['worker']
+
+    if worker['properties'].get('tuxedo_server_url'):
+        resolve_keyed_by(
+            worker, 'properties.tuxedo_server_url', worker['buildername'],
+            **config.params
+        )
+
     task_def['payload'] = {
         'buildername': worker['buildername'],
         'sourcestamp': worker['sourcestamp'],
         'properties': worker['properties'],
     }
     task_def.setdefault('scopes', [])
     if worker['properties'].get('release_promotion'):
         task_def['scopes'].append(