Bug 1433459 - part 2: Move aliases tasks to scriptworker r=mtabara,rail

MozReview-Commit-ID: Ld6ZQPBZYjX

--HG--
extra : rebase_source : 83ce7b0d783bf90b362711958f5963c46f5bedf2
This commit is contained in:
Johan Lorenzo 2018-02-26 15:21:54 +01:00
parent 084a9fc1fe
commit 03c8a9b27c
4 changed files with 134 additions and 30 deletions

View File

@ -6,7 +6,7 @@ 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
@ -15,39 +15,36 @@ kind-dependencies:
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

View File

@ -13,7 +13,6 @@ 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
@ -32,7 +31,6 @@ job-defaults:
- project:releng:bouncer:server:staging
run-on-projects: []
shipping-phase: promote
shipping-product: firefox
locales-file: browser/locales/l10n-changesets.json
jobs:

View File

@ -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

View File

@ -558,6 +558,9 @@ task_description_schema = Schema({
# Paths to the artifacts to sign
Required('paths'): [basestring],
}],
}, {
Required('implementation'): 'bouncer-aliases',
Required('entries'): object,
}, {
Required('implementation'): 'bouncer-submission',
Required('locales'): [basestring],
@ -1115,6 +1118,15 @@ def build_balrog_payload(config, task, task_def):
})
@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']