Bug 1458700: [taskgraph] Move load_graph_config into taskgraph.config; r=dustin
Differential Revision: https://phabricator.services.mozilla.com/D1123
This commit is contained in:
@@ -1265,7 +1265,8 @@ class PackageFrontend(MachCommandBase):
|
||||
import requests
|
||||
import shutil
|
||||
|
||||
from taskgraph.generator import load_graph_config, Kind
|
||||
from taskgraph.config import load_graph_config
|
||||
from taskgraph.generator import Kind
|
||||
from taskgraph.util.taskcluster import (
|
||||
get_artifact_url,
|
||||
list_artifacts,
|
||||
|
||||
@@ -14,7 +14,7 @@ from slugid import nice as slugid
|
||||
from types import FunctionType
|
||||
from collections import namedtuple
|
||||
from taskgraph import create, GECKO
|
||||
from taskgraph.generator import load_graph_config
|
||||
from taskgraph.config import load_graph_config
|
||||
from taskgraph.util import taskcluster
|
||||
from taskgraph.parameters import Parameters
|
||||
|
||||
|
||||
@@ -4,9 +4,15 @@
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import os
|
||||
import logging
|
||||
import yaml
|
||||
|
||||
from .util.schema import validate_schema, Schema
|
||||
from voluptuous import Required
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
graph_config_schema = Schema({
|
||||
# The trust-domain for this graph.
|
||||
# (See https://firefox-source-docs.mozilla.org/taskcluster/taskcluster/taskgraph.html#taskgraph-trust-domain) # noqa
|
||||
@@ -44,3 +50,16 @@ graph_config_schema = Schema({
|
||||
|
||||
def validate_graph_config(config):
|
||||
return validate_schema(graph_config_schema, config, "Invalid graph configuration:")
|
||||
|
||||
|
||||
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))
|
||||
with open(config_yml) as f:
|
||||
config = yaml.load(f)
|
||||
|
||||
validate_graph_config(config)
|
||||
return config
|
||||
|
||||
@@ -20,7 +20,7 @@ from .util.verify import (
|
||||
verify_docs,
|
||||
verifications,
|
||||
)
|
||||
from .config import validate_graph_config
|
||||
from .config import load_graph_config
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -87,19 +87,6 @@ class Kind(object):
|
||||
return cls(kind_name, path, config, graph_config)
|
||||
|
||||
|
||||
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))
|
||||
with open(config_yml) as f:
|
||||
config = yaml.load(f)
|
||||
|
||||
validate_graph_config(config)
|
||||
return config
|
||||
|
||||
|
||||
class TaskGraphGenerator(object):
|
||||
"""
|
||||
The central controller for taskgraph. This handles all phases of graph
|
||||
|
||||
Reference in New Issue
Block a user