2017-10-30 03:32:22 +03:00
|
|
|
# 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/.
|
|
|
|
"""
|
2018-05-04 18:37:46 +03:00
|
|
|
Transform the beetmover-push-to-release task into a task description.
|
2017-10-30 03:32:22 +03:00
|
|
|
"""
|
|
|
|
|
|
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
|
|
|
|
|
|
|
from taskgraph.transforms.base import TransformSequence
|
2018-09-25 23:26:55 +03:00
|
|
|
from taskgraph.util.schema import (
|
|
|
|
Schema,
|
|
|
|
taskref_or_string,
|
|
|
|
)
|
2017-10-30 03:32:22 +03:00
|
|
|
from taskgraph.util.scriptworker import (
|
2018-10-11 07:23:52 +03:00
|
|
|
get_beetmover_bucket_scope, add_scope_prefix,
|
2018-03-20 20:24:06 +03:00
|
|
|
get_worker_type_for_scope,
|
2017-10-30 03:32:22 +03:00
|
|
|
)
|
|
|
|
from taskgraph.transforms.task import task_description_schema
|
2018-09-25 23:26:55 +03:00
|
|
|
from voluptuous import Required, Optional
|
2017-10-30 03:32:22 +03:00
|
|
|
|
|
|
|
|
2018-05-04 18:37:46 +03:00
|
|
|
beetmover_push_to_release_description_schema = Schema({
|
2017-10-30 03:32:22 +03:00
|
|
|
Required('name'): basestring,
|
|
|
|
Required('product'): basestring,
|
|
|
|
Required('treeherder-platform'): basestring,
|
|
|
|
Optional('attributes'): {basestring: object},
|
|
|
|
Optional('job-from'): task_description_schema['job-from'],
|
|
|
|
Optional('run'): {basestring: object},
|
|
|
|
Optional('run-on-projects'): task_description_schema['run-on-projects'],
|
2017-10-30 03:40:50 +03:00
|
|
|
Optional('dependencies'): {basestring: taskref_or_string},
|
2017-11-08 07:57:35 +03:00
|
|
|
Optional('index'): {basestring: basestring},
|
|
|
|
Optional('routes'): [basestring],
|
2017-11-09 05:02:28 +03:00
|
|
|
Required('shipping-phase'): task_description_schema['shipping-phase'],
|
|
|
|
Required('shipping-product'): task_description_schema['shipping-product'],
|
2018-02-14 02:57:50 +03:00
|
|
|
Optional('extra'): task_description_schema['extra'],
|
2017-10-30 03:32:22 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
|
2018-11-21 02:44:12 +03:00
|
|
|
transforms = TransformSequence()
|
|
|
|
transforms.add_validate(beetmover_push_to_release_description_schema)
|
2017-10-30 03:32:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
@transforms.add
|
2018-05-04 18:37:46 +03:00
|
|
|
def make_beetmover_push_to_release_description(config, jobs):
|
2017-10-30 03:32:22 +03:00
|
|
|
for job in jobs:
|
|
|
|
treeherder = job.get('treeherder', {})
|
|
|
|
treeherder.setdefault('symbol', 'Rel(BM-C)')
|
|
|
|
treeherder.setdefault('tier', 1)
|
|
|
|
treeherder.setdefault('kind', 'build')
|
|
|
|
treeherder.setdefault('platform', job['treeherder-platform'])
|
|
|
|
|
|
|
|
label = job['name']
|
|
|
|
description = (
|
2018-05-04 18:37:46 +03:00
|
|
|
"Beetmover push to release for '{product}'".format(
|
2017-10-30 03:32:22 +03:00
|
|
|
product=job['product']
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
bucket_scope = get_beetmover_bucket_scope(config)
|
2018-10-11 07:23:52 +03:00
|
|
|
action_scope = add_scope_prefix(config, 'beetmover:action:push-to-releases')
|
2017-10-30 03:32:22 +03:00
|
|
|
|
|
|
|
task = {
|
|
|
|
'label': label,
|
|
|
|
'description': description,
|
2018-03-20 20:24:06 +03:00
|
|
|
'worker-type': get_worker_type_for_scope(config, bucket_scope),
|
2017-10-30 03:32:22 +03:00
|
|
|
'scopes': [bucket_scope, action_scope],
|
|
|
|
'product': job['product'],
|
2017-10-30 03:40:50 +03:00
|
|
|
'dependencies': job['dependencies'],
|
2017-10-30 03:32:22 +03:00
|
|
|
'attributes': job.get('attributes', {}),
|
|
|
|
'run-on-projects': job.get('run-on-projects'),
|
|
|
|
'treeherder': treeherder,
|
2017-12-06 06:18:43 +03:00
|
|
|
'shipping-phase': job.get('shipping-phase', 'push'),
|
|
|
|
'shipping-product': job.get('shipping-product'),
|
2018-02-14 02:57:50 +03:00
|
|
|
'routes': job.get('routes', []),
|
|
|
|
'extra': job.get('extra', {}),
|
2017-10-30 03:32:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
yield task
|
|
|
|
|
|
|
|
|
|
|
|
@transforms.add
|
2018-05-04 18:37:46 +03:00
|
|
|
def make_beetmover_push_to_release_worker(config, jobs):
|
2017-10-30 03:32:22 +03:00
|
|
|
for job in jobs:
|
|
|
|
worker = {
|
2018-05-04 18:37:46 +03:00
|
|
|
'implementation': 'beetmover-push-to-release',
|
2017-10-30 03:32:22 +03:00
|
|
|
'product': job['product'],
|
|
|
|
}
|
|
|
|
job["worker"] = worker
|
|
|
|
del(job['product'])
|
|
|
|
|
|
|
|
yield job
|