Bug 1433459 - part 2: Move aliases tasks to scriptworker r=mtabara,rail
MozReview-Commit-ID: Ld6ZQPBZYjX
--- a/taskcluster/ci/release-bouncer-aliases/kind.yml
+++ b/taskcluster/ci/release-bouncer-aliases/kind.yml
@@ -1,53 +1,50 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
loader: taskgraph.loader.transform:loader
transforms:
- taskgraph.transforms.release_deps:transforms
- - taskgraph.transforms.job:transforms
+ - taskgraph.transforms.bouncer_aliases:transforms
- taskgraph.transforms.release_notifications:transforms
- taskgraph.transforms.task:transforms
kind-dependencies:
- release-bouncer-check
job-defaults:
description: Update bouncer aliases job
- worker-type: buildbot-bridge/buildbot-bridge
+ worker-type:
+ by-project:
+ mozilla-beta: scriptworker-prov-v1/bouncer-v1
+ mozilla-release: scriptworker-prov-v1/bouncer-v1
+ default: scriptworker-prov-v1/bouncer-dev
+ worker:
+ implementation: bouncer-aliases
+ scopes:
+ by-project:
+ mozilla-beta:
+ - project:releng:bouncer:action:submission
+ - project:releng:bouncer:server:production
+ mozilla-release:
+ - project:releng:bouncer:action:submission
+ - project:releng:bouncer:server:production
+ default:
+ - project:releng:bouncer:action:submission
+ - project:releng:bouncer:server:staging
run-on-projects: []
shipping-phase: ship
- run:
- using: buildbot
- 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-releng.stage.mozaws.net/api
- default: http://localhost/api
jobs:
+ devedition:
+ bouncer-products: ['installer', 'installer-ssl', 'stub-installer']
+ shipping-product: devedition
+
fennec:
- name: fennec_release_bouncer_aliases
+ bouncer-products: ['apk']
shipping-product: fennec
- run:
- product: fennec
- buildername: release-{branch}-fennec_bouncer_aliases
firefox:
- name: firefox_release_bouncer_aliases
+ bouncer-products: ['installer', 'installer-ssl', 'stub-installer']
shipping-product: firefox
- run:
- product: firefox
- buildername: release-{branch}-firefox_bouncer_aliases
-
- devedition:
- name: devedition_release_bouncer_aliases
- shipping-product: devedition
- run:
- product: devedition
- buildername: release-{branch}-devedition_bouncer_aliases
--- a/taskcluster/ci/release-bouncer-sub/kind.yml
+++ b/taskcluster/ci/release-bouncer-sub/kind.yml
@@ -8,17 +8,16 @@ transforms:
- taskgraph.transforms.bouncer_submission:transforms
- taskgraph.transforms.release_notifications:transforms
- taskgraph.transforms.task:transforms
job-defaults:
description: release bouncer submission job
worker-type:
by-project:
- mozilla-central: scriptworker-prov-v1/bouncer-v1
mozilla-beta: scriptworker-prov-v1/bouncer-v1
mozilla-release: scriptworker-prov-v1/bouncer-v1
default: scriptworker-prov-v1/bouncer-dev
worker:
implementation: bouncer-submission
scopes:
by-project:
mozilla-beta:
@@ -27,17 +26,16 @@ job-defaults:
mozilla-release:
- project:releng:bouncer:action:submission
- project:releng:bouncer:server:production
default:
- project:releng:bouncer:action:submission
- project:releng:bouncer:server:staging
run-on-projects: []
shipping-phase: promote
- shipping-product: firefox
locales-file: browser/locales/l10n-changesets.json
jobs:
devedition:
bouncer-platforms: ['linux', 'linux64', 'osx', 'win', 'win64']
bouncer-products: ['complete-mar', 'installer', 'installer-ssl', 'partial-mar', 'stub-installer']
shipping-product: devedition
new file mode 100644
--- /dev/null
+++ b/taskcluster/taskgraph/transforms/bouncer_aliases.py
@@ -0,0 +1,97 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+"""
+Add from parameters.yml into bouncer submission tasks.
+"""
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+import logging
+
+from taskgraph.transforms.base import TransformSequence
+from taskgraph.transforms.bouncer_submission import craft_bouncer_product_name
+from taskgraph.util.schema import resolve_keyed_by
+from taskgraph.util.scriptworker import get_release_config
+
+logger = logging.getLogger(__name__)
+
+transforms = TransformSequence()
+
+
+@transforms.add
+def make_task_worker(config, jobs):
+ for job in jobs:
+ resolve_keyed_by(
+ job, 'worker-type', item_name=job['name'], project=config.params['project']
+ )
+ resolve_keyed_by(
+ job, 'scopes', item_name=job['name'], project=config.params['project']
+ )
+
+ job['scopes'].append('project:releng:bouncer:action:aliases')
+ job['worker']['entries'] = craft_bouncer_entries(config, job)
+
+ del job['bouncer-products']
+
+ if job['worker']['entries']:
+ yield job
+ else:
+ logger.warn('No bouncer entries defined in bouncer submission task for "{}". \
+Job deleted.'.format(job['name']))
+
+
+def craft_bouncer_entries(config, job):
+ release_config = get_release_config(config)
+
+ product = job['shipping-product']
+ release_type = config.params['release_type']
+ # The release_type is defined but may point to None.
+ if not release_type:
+ release_type = ''
+ current_version = release_config['version']
+ bouncer_products = job['bouncer-products']
+
+ return {
+ craft_bouncer_alias(product, bouncer_product, release_type): craft_bouncer_product_name(
+ product, bouncer_product, current_version,
+ )
+ for bouncer_product in bouncer_products
+ }
+
+
+def craft_bouncer_alias(product, bouncer_product, release_type):
+ return '{product}{channel}{postfix}'.format(
+ product=_craft_product(product),
+ channel=_craft_channel_string_of_alias(product, release_type),
+ postfix=_craft_alias_postfix(bouncer_product)
+ )
+
+
+def _craft_product(product):
+ # XXX devedition is provided in the channel function
+ return 'firefox' if product == 'devedition' else product
+
+
+def _craft_channel_string_of_alias(product, release_type):
+ if product == 'devedition':
+ return '-devedition'
+ elif release_type == 'beta':
+ return '-beta'
+ elif 'esr' in release_type:
+ return '-esr'
+
+ return ''
+
+
+def _craft_alias_postfix(bouncer_product):
+ if 'stub' in bouncer_product:
+ postfix = '-stub'
+ elif 'installer' in bouncer_product or bouncer_product == 'apk':
+ postfix = '-latest'
+ if 'ssl' in bouncer_product:
+ postfix = '{}-ssl'.format(postfix)
+ else:
+ raise Exception('Unknown bouncer product "{}"'.format(bouncer_product))
+
+ return postfix
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -554,16 +554,19 @@ task_description_schema = Schema({
# type of signing task (for CoT)
Required('taskType'): basestring,
# Paths to the artifacts to sign
Required('paths'): [basestring],
}],
}, {
+ Required('implementation'): 'bouncer-aliases',
+ Required('entries'): object,
+ }, {
Required('implementation'): 'bouncer-submission',
Required('locales'): [basestring],
Required('entries'): object,
}, {
Required('implementation'): 'push-apk-breakpoint',
Required('payload'): object,
}, {
Required('implementation'): 'invalid',
@@ -1103,16 +1106,25 @@ def build_balrog_payload(config, task, t
})
else: # schedule / ship
task_def['payload'].update({
'publish_rules': worker['publish-rules'],
'release_eta': config.params.get('release_eta') or '',
})
+@payload_builder('bouncer-aliases')
+def build_bouncer_aliases_payload(config, task, task_def):
+ worker = task['worker']
+
+ task_def['payload'] = {
+ 'aliases_entries': worker['entries']
+ }
+
+
@payload_builder('bouncer-submission')
def build_bouncer_submission_payload(config, task, task_def):
worker = task['worker']
task_def['payload'] = {
'locales': worker['locales'],
'submission_entries': worker['entries']
}