2017-11-02 20:37:20 +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/.
|
|
|
|
|
|
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
|
|
|
|
2018-05-03 04:28:43 +03:00
|
|
|
import os
|
|
|
|
import logging
|
2018-05-03 05:28:11 +03:00
|
|
|
import attr
|
2019-03-19 22:13:56 +03:00
|
|
|
from six import text_type
|
2018-05-03 05:30:15 +03:00
|
|
|
from mozpack import path
|
2018-05-03 04:28:43 +03:00
|
|
|
|
2018-12-27 12:30:52 +03:00
|
|
|
from .util.schema import validate_schema, Schema, optionally_keyed_by
|
|
|
|
from voluptuous import Required, Optional, Any
|
2019-02-04 19:55:54 +03:00
|
|
|
from .util.yaml import load_yaml
|
2017-11-02 20:37:20 +03:00
|
|
|
|
2018-05-03 04:28:43 +03:00
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
2017-11-02 20:37:20 +03:00
|
|
|
graph_config_schema = Schema({
|
2017-11-10 03:15:29 +03:00
|
|
|
# The trust-domain for this graph.
|
|
|
|
# (See https://firefox-source-docs.mozilla.org/taskcluster/taskcluster/taskgraph.html#taskgraph-trust-domain) # noqa
|
|
|
|
Required('trust-domain'): basestring,
|
2018-04-11 20:08:48 +03:00
|
|
|
# This specifes the prefix for repo parameters that refer to the project being built.
|
|
|
|
# This selects between `head_rev` and `comm_head_rev` and related paramters.
|
|
|
|
# (See http://firefox-source-docs.mozilla.org/taskcluster/taskcluster/parameters.html#push-information # noqa
|
|
|
|
# and http://firefox-source-docs.mozilla.org/taskcluster/taskcluster/parameters.html#comm-push-information) # noqa
|
|
|
|
Required('project-repo-param-prefix'): basestring,
|
2018-09-29 23:53:10 +03:00
|
|
|
# This specifies the top level directory of the application being built.
|
|
|
|
# ie. "browser/" for Firefox, "comm/mail/" for Thunderbird.
|
|
|
|
Required('product-dir'): basestring,
|
2017-11-02 20:37:20 +03:00
|
|
|
Required('treeherder'): {
|
|
|
|
# Mapping of treeherder group symbols to descriptive names
|
|
|
|
Required('group-names'): {basestring: basestring}
|
2017-11-02 23:34:47 +03:00
|
|
|
},
|
2017-12-14 02:00:14 +03:00
|
|
|
Required('index'): {
|
2018-09-29 23:53:10 +03:00
|
|
|
Required('products'): [basestring]
|
2017-12-14 02:00:14 +03:00
|
|
|
},
|
2017-11-02 23:34:47 +03:00
|
|
|
Required('try'): {
|
|
|
|
# We have a few platforms for which we want to do some "extra" builds, or at
|
|
|
|
# least build-ish things. Sort of. Anyway, these other things are implemented
|
|
|
|
# as different "platforms". These do *not* automatically ride along with "-p
|
|
|
|
# all"
|
2018-10-03 00:17:07 +03:00
|
|
|
Required('ridealong-builds'): {basestring: [basestring]},
|
2017-11-02 23:34:47 +03:00
|
|
|
},
|
2018-04-19 18:21:30 +03:00
|
|
|
Required('release-promotion'): {
|
|
|
|
Required('products'): [basestring],
|
2018-04-23 09:17:30 +03:00
|
|
|
Required('flavors'): {basestring: {
|
|
|
|
Required('product'): basestring,
|
|
|
|
Required('target-tasks-method'): basestring,
|
2018-09-17 21:09:16 +03:00
|
|
|
Optional('is-rc'): bool,
|
2018-04-23 09:17:30 +03:00
|
|
|
Optional('rebuild-kinds'): [basestring],
|
2018-05-30 10:16:41 +03:00
|
|
|
Optional('version-bump'): bool,
|
|
|
|
Optional('partial-updates'): bool,
|
2018-04-23 09:17:30 +03:00
|
|
|
}},
|
2018-04-19 18:21:30 +03:00
|
|
|
},
|
2018-01-09 20:44:04 +03:00
|
|
|
Required('scriptworker'): {
|
2018-01-12 11:08:54 +03:00
|
|
|
# Prefix to add to scopes controlling scriptworkers
|
|
|
|
Required('scope-prefix'): basestring,
|
2018-01-09 20:44:04 +03:00
|
|
|
# Mapping of scriptworker types to scopes they accept
|
|
|
|
Required('worker-types'): {basestring: [basestring]}
|
|
|
|
},
|
2019-03-07 07:20:36 +03:00
|
|
|
Required('task-priority'): optionally_keyed_by('project', Any(
|
|
|
|
'highest',
|
|
|
|
'very-high',
|
|
|
|
'high',
|
|
|
|
'medium',
|
|
|
|
'low',
|
|
|
|
'very-low',
|
|
|
|
'lowest',
|
|
|
|
)),
|
2018-12-27 12:30:52 +03:00
|
|
|
Required('partner-urls'): {
|
|
|
|
Required('release-partner-repack'):
|
|
|
|
optionally_keyed_by('release-product', 'release-level', 'release-type',
|
|
|
|
Any(basestring, None)),
|
|
|
|
Required('release-eme-free-repack'):
|
|
|
|
optionally_keyed_by('release-product', 'release-level', 'release-type',
|
|
|
|
Any(basestring, None)),
|
2018-04-26 01:16:49 +03:00
|
|
|
},
|
2019-03-19 22:13:56 +03:00
|
|
|
Required('workers'): {
|
|
|
|
Required('aliases'): {
|
|
|
|
text_type: {
|
|
|
|
Required('provisioner'): text_type,
|
|
|
|
Required('implementation'): text_type,
|
|
|
|
Required('os'): text_type,
|
|
|
|
Required('worker-type'): optionally_keyed_by('level', text_type),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2019-06-06 01:02:25 +03:00
|
|
|
Required('mac-notarization'): {
|
|
|
|
Required('mac-behavior'):
|
|
|
|
optionally_keyed_by('platform', 'release-type',
|
2019-07-15 19:38:43 +03:00
|
|
|
Any('mac_notarize', 'mac_geckodriver', 'mac_sign',
|
|
|
|
'mac_sign_and_pkg')),
|
2019-06-06 01:03:36 +03:00
|
|
|
Required('mac-entitlements'):
|
|
|
|
optionally_keyed_by('platform', 'project', text_type),
|
2019-06-06 01:02:25 +03:00
|
|
|
},
|
2017-11-02 20:37:20 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
|
2019-03-07 07:20:36 +03:00
|
|
|
@attr.s(frozen=True, cmp=False)
|
2018-05-03 05:28:11 +03:00
|
|
|
class GraphConfig(object):
|
|
|
|
_config = attr.ib()
|
|
|
|
root_dir = attr.ib()
|
|
|
|
|
|
|
|
def __getitem__(self, name):
|
|
|
|
return self._config[name]
|
|
|
|
|
2018-05-03 05:30:15 +03:00
|
|
|
@property
|
|
|
|
def taskcluster_yml(self):
|
|
|
|
if path.split(self.root_dir)[-2:] != ['taskcluster', 'ci']:
|
|
|
|
raise Exception(
|
|
|
|
"Not guessing path to `.taskcluster.yml`. "
|
|
|
|
"Graph config in non-standard location."
|
|
|
|
)
|
|
|
|
return os.path.join(
|
|
|
|
os.path.dirname(os.path.dirname(self.root_dir)),
|
|
|
|
".taskcluster.yml",
|
|
|
|
)
|
|
|
|
|
2018-05-03 05:28:11 +03:00
|
|
|
|
2017-11-02 20:37:20 +03:00
|
|
|
def validate_graph_config(config):
|
2018-10-03 00:17:07 +03:00
|
|
|
validate_schema(graph_config_schema, config, "Invalid graph configuration:")
|
2018-05-03 04:28:43 +03:00
|
|
|
|
|
|
|
|
|
|
|
def load_graph_config(root_dir):
|
|
|
|
config_yml = os.path.join(root_dir, "config.yml")
|
|
|
|
if not os.path.exists(config_yml):
|
|
|
|
raise Exception("Couldn't find taskgraph configuration: {}".format(config_yml))
|
|
|
|
|
|
|
|
logger.debug("loading config from `{}`".format(config_yml))
|
2019-02-04 19:55:54 +03:00
|
|
|
config = load_yaml(config_yml)
|
2018-05-03 04:28:43 +03:00
|
|
|
|
|
|
|
validate_graph_config(config)
|
2018-05-03 05:28:11 +03:00
|
|
|
return GraphConfig(config=config, root_dir=root_dir)
|