2016-09-12 21:34:06 +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/.
|
|
|
|
"""
|
|
|
|
Apply some defaults and minor modifications to the jobs defined in the build
|
|
|
|
kind.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
|
|
|
|
|
|
|
from taskgraph.transforms.base import TransformSequence
|
2018-07-30 23:23:14 +03:00
|
|
|
from taskgraph.util.attributes import RELEASE_PROJECTS
|
2018-05-23 01:22:37 +03:00
|
|
|
from taskgraph.util.schema import resolve_keyed_by
|
Bug 1359976: base worker payload generation on worker-type; r=wcosta r=aki
To date we have variously specified both worker-type and worker-implementation,
often manually coordinated. We also embedded a few awkward assumptions such as
that the native engine only runs on OS X.
But a worker type has one and only one implementation, and that implementation
is stable over time (as changing it would require simultaneous landings on all
trees).
Instead, this change makes worker-type the primary configuration, and derives
both a worker implementation (defining the payload format) and worker OS
(determining what to include in the payload) from that value. The derivation
occurs when deciding how to implement a particular job, where the run_using
functions are distinguished by worker implementation.
The two-part logic to determine how and where to run a test task based on its
platform is combined into a single transform, `set_worker_type`.
This contains some other related changes:
- MOZ_AUTOMATION is set in specific jobs, rather than everywhere docker-worker
is used
- the URL to test packages is factored out into a shared function
- docker-worker test defaults are applied in `mozharness_test.py`
- the WORKER_TYPE array in `task.py`, formerly mixing two types of keys, is
split
- the 'invalid' workerType is assigned an 'invalid' implementation
- all tasks that do not use job descriptions but use docker-worker, etc. have
`worker.os` added
Tested to not produce a substantially different taskgraph for a regular push, a
try push, or a nightly cron.
MozReview-Commit-ID: LDHrmrpBo7I
--HG--
extra : rebase_source : 4cdfe6b8d9874b0c156671515b213d820b48482f
2017-05-09 01:53:50 +03:00
|
|
|
from taskgraph.util.workertypes import worker_type_implementation
|
2016-09-12 21:34:06 +03:00
|
|
|
|
2018-07-30 23:23:14 +03:00
|
|
|
import logging
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
2016-09-12 21:34:06 +03:00
|
|
|
transforms = TransformSequence()
|
|
|
|
|
|
|
|
|
|
|
|
@transforms.add
|
|
|
|
def set_defaults(config, jobs):
|
|
|
|
"""Set defaults, including those that differ per worker implementation"""
|
|
|
|
for job in jobs:
|
|
|
|
job['treeherder'].setdefault('kind', 'build')
|
|
|
|
job['treeherder'].setdefault('tier', 1)
|
Bug 1359976: base worker payload generation on worker-type; r=wcosta r=aki
To date we have variously specified both worker-type and worker-implementation,
often manually coordinated. We also embedded a few awkward assumptions such as
that the native engine only runs on OS X.
But a worker type has one and only one implementation, and that implementation
is stable over time (as changing it would require simultaneous landings on all
trees).
Instead, this change makes worker-type the primary configuration, and derives
both a worker implementation (defining the payload format) and worker OS
(determining what to include in the payload) from that value. The derivation
occurs when deciding how to implement a particular job, where the run_using
functions are distinguished by worker implementation.
The two-part logic to determine how and where to run a test task based on its
platform is combined into a single transform, `set_worker_type`.
This contains some other related changes:
- MOZ_AUTOMATION is set in specific jobs, rather than everywhere docker-worker
is used
- the URL to test packages is factored out into a shared function
- docker-worker test defaults are applied in `mozharness_test.py`
- the WORKER_TYPE array in `task.py`, formerly mixing two types of keys, is
split
- the 'invalid' workerType is assigned an 'invalid' implementation
- all tasks that do not use job descriptions but use docker-worker, etc. have
`worker.os` added
Tested to not produce a substantially different taskgraph for a regular push, a
try push, or a nightly cron.
MozReview-Commit-ID: LDHrmrpBo7I
--HG--
extra : rebase_source : 4cdfe6b8d9874b0c156671515b213d820b48482f
2017-05-09 01:53:50 +03:00
|
|
|
_, worker_os = worker_type_implementation(job['worker-type'])
|
2017-06-29 23:50:13 +03:00
|
|
|
worker = job.setdefault('worker', {})
|
2017-12-19 21:19:52 +03:00
|
|
|
worker.setdefault('env', {})
|
Bug 1359976: base worker payload generation on worker-type; r=wcosta r=aki
To date we have variously specified both worker-type and worker-implementation,
often manually coordinated. We also embedded a few awkward assumptions such as
that the native engine only runs on OS X.
But a worker type has one and only one implementation, and that implementation
is stable over time (as changing it would require simultaneous landings on all
trees).
Instead, this change makes worker-type the primary configuration, and derives
both a worker implementation (defining the payload format) and worker OS
(determining what to include in the payload) from that value. The derivation
occurs when deciding how to implement a particular job, where the run_using
functions are distinguished by worker implementation.
The two-part logic to determine how and where to run a test task based on its
platform is combined into a single transform, `set_worker_type`.
This contains some other related changes:
- MOZ_AUTOMATION is set in specific jobs, rather than everywhere docker-worker
is used
- the URL to test packages is factored out into a shared function
- docker-worker test defaults are applied in `mozharness_test.py`
- the WORKER_TYPE array in `task.py`, formerly mixing two types of keys, is
split
- the 'invalid' workerType is assigned an 'invalid' implementation
- all tasks that do not use job descriptions but use docker-worker, etc. have
`worker.os` added
Tested to not produce a substantially different taskgraph for a regular push, a
try push, or a nightly cron.
MozReview-Commit-ID: LDHrmrpBo7I
--HG--
extra : rebase_source : 4cdfe6b8d9874b0c156671515b213d820b48482f
2017-05-09 01:53:50 +03:00
|
|
|
if worker_os == "linux":
|
2018-01-12 10:46:40 +03:00
|
|
|
worker.setdefault('docker-image', {'in-tree': 'debian7-amd64-build'})
|
Bug 1359976: base worker payload generation on worker-type; r=wcosta r=aki
To date we have variously specified both worker-type and worker-implementation,
often manually coordinated. We also embedded a few awkward assumptions such as
that the native engine only runs on OS X.
But a worker type has one and only one implementation, and that implementation
is stable over time (as changing it would require simultaneous landings on all
trees).
Instead, this change makes worker-type the primary configuration, and derives
both a worker implementation (defining the payload format) and worker OS
(determining what to include in the payload) from that value. The derivation
occurs when deciding how to implement a particular job, where the run_using
functions are distinguished by worker implementation.
The two-part logic to determine how and where to run a test task based on its
platform is combined into a single transform, `set_worker_type`.
This contains some other related changes:
- MOZ_AUTOMATION is set in specific jobs, rather than everywhere docker-worker
is used
- the URL to test packages is factored out into a shared function
- docker-worker test defaults are applied in `mozharness_test.py`
- the WORKER_TYPE array in `task.py`, formerly mixing two types of keys, is
split
- the 'invalid' workerType is assigned an 'invalid' implementation
- all tasks that do not use job descriptions but use docker-worker, etc. have
`worker.os` added
Tested to not produce a substantially different taskgraph for a regular push, a
try push, or a nightly cron.
MozReview-Commit-ID: LDHrmrpBo7I
--HG--
extra : rebase_source : 4cdfe6b8d9874b0c156671515b213d820b48482f
2017-05-09 01:53:50 +03:00
|
|
|
worker['chain-of-trust'] = True
|
2017-06-29 23:50:13 +03:00
|
|
|
elif worker_os == "windows":
|
|
|
|
worker['chain-of-trust'] = True
|
|
|
|
|
2017-02-02 14:34:43 +03:00
|
|
|
yield job
|
|
|
|
|
|
|
|
|
2018-05-23 01:22:37 +03:00
|
|
|
@transforms.add
|
|
|
|
def stub_installer(config, jobs):
|
|
|
|
for job in jobs:
|
2018-06-15 21:52:54 +03:00
|
|
|
resolve_keyed_by(
|
|
|
|
job, 'stub-installer', item_name=job['name'], project=config.params['project']
|
|
|
|
)
|
2018-05-23 01:22:37 +03:00
|
|
|
job.setdefault('attributes', {})
|
|
|
|
if job.get('stub-installer'):
|
|
|
|
job['attributes']['stub-installer'] = job['stub-installer']
|
|
|
|
job['worker']['env'].update({"USE_STUB_INSTALLER": "1"})
|
2018-06-15 21:52:54 +03:00
|
|
|
if 'stub-installer' in job:
|
|
|
|
del job['stub-installer']
|
2018-05-23 01:22:37 +03:00
|
|
|
yield job
|
|
|
|
|
|
|
|
|
2018-10-23 22:11:31 +03:00
|
|
|
@transforms.add
|
|
|
|
def update_channel(config, jobs):
|
|
|
|
for job in jobs:
|
|
|
|
resolve_keyed_by(
|
|
|
|
job, 'run.update-channel', item_name=job['name'],
|
|
|
|
**{
|
|
|
|
'release-type': config.params['release_type'],
|
|
|
|
}
|
|
|
|
)
|
|
|
|
update_channel = job['run'].pop('update-channel', None)
|
|
|
|
if update_channel:
|
|
|
|
job['run'].setdefault('extra-config', {})['update_channel'] = update_channel
|
|
|
|
yield job
|
|
|
|
|
|
|
|
|
2018-10-24 00:27:42 +03:00
|
|
|
@transforms.add
|
|
|
|
def mozconfig(config, jobs):
|
|
|
|
for job in jobs:
|
|
|
|
resolve_keyed_by(
|
|
|
|
job, 'run.mozconfig-variant', item_name=job['name'],
|
|
|
|
**{
|
|
|
|
'release-type': config.params['release_type'],
|
|
|
|
}
|
|
|
|
)
|
|
|
|
mozconfig_variant = job['run'].pop('mozconfig-variant', None)
|
|
|
|
if mozconfig_variant:
|
|
|
|
job['run'].setdefault('extra-config', {})['mozconfig_variant'] = mozconfig_variant
|
|
|
|
yield job
|
|
|
|
|
|
|
|
|
2019-01-10 04:34:58 +03:00
|
|
|
@transforms.add
|
|
|
|
def use_profile_data(config, jobs):
|
|
|
|
for job in jobs:
|
|
|
|
if not job.pop('use-pgo', False):
|
|
|
|
yield job
|
|
|
|
continue
|
|
|
|
|
|
|
|
dependencies = 'generate-profile-{}'.format(job['name'])
|
|
|
|
job.setdefault('dependencies', {})['generate-profile'] = dependencies
|
|
|
|
job.setdefault('fetches', {})['generate-profile'] = ['profdata.tar.xz']
|
|
|
|
yield job
|
|
|
|
|
|
|
|
|
2017-02-02 14:34:43 +03:00
|
|
|
@transforms.add
|
|
|
|
def set_env(config, jobs):
|
|
|
|
"""Set extra environment variables from try command line."""
|
2018-05-23 01:22:37 +03:00
|
|
|
env = []
|
2017-08-22 02:14:14 +03:00
|
|
|
if config.params['try_mode'] == 'try_option_syntax':
|
2018-05-23 01:22:37 +03:00
|
|
|
env = config.params['try_options']['env'] or []
|
2017-02-02 14:34:43 +03:00
|
|
|
for job in jobs:
|
|
|
|
if env:
|
2017-12-19 21:19:52 +03:00
|
|
|
job['worker']['env'].update(dict(x.split('=') for x in env))
|
2016-09-12 21:34:06 +03:00
|
|
|
yield job
|
2018-07-30 23:23:14 +03:00
|
|
|
|
|
|
|
|
|
|
|
@transforms.add
|
|
|
|
def enable_full_crashsymbols(config, jobs):
|
|
|
|
"""Enable full crashsymbols on jobs with
|
|
|
|
'enable-full-crashsymbols' set to True and on release branches, or
|
|
|
|
on try"""
|
|
|
|
branches = RELEASE_PROJECTS | {'try', }
|
|
|
|
for job in jobs:
|
|
|
|
enable_full_crashsymbols = job['attributes'].get('enable-full-crashsymbols')
|
|
|
|
if enable_full_crashsymbols and config.params['project'] in branches:
|
|
|
|
logger.debug("Enabling full symbol generation for %s", job['name'])
|
|
|
|
else:
|
|
|
|
logger.debug("Disabling full symbol generation for %s", job['name'])
|
|
|
|
job['worker']['env']['MOZ_DISABLE_FULL_SYMBOLS'] = '1'
|
|
|
|
yield job
|