mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1273633: support per-branch config in the decision task; r=garndt
MozReview-Commit-ID: LXQIaSzPpr4 --HG-- extra : rebase_source : ebdbc008d0547b84edef5f92e12325a1b90a437a
This commit is contained in:
parent
ba59499daf
commit
e98ea9da30
@ -94,7 +94,6 @@ tasks:
|
||||
cd workspace/gecko &&
|
||||
ln -s /home/worker/artifacts artifacts &&
|
||||
./mach taskgraph decision
|
||||
--target-tasks-method=try_option_syntax
|
||||
--pushlog-id='{{pushlog_id}}'
|
||||
--project='{{project}}'
|
||||
--message='{{comment}}'
|
||||
|
@ -13,11 +13,26 @@ import yaml
|
||||
|
||||
from .generator import TaskGraphGenerator
|
||||
from .create import create_tasks
|
||||
from .parameters import get_decision_parameters
|
||||
from .parameters import Parameters
|
||||
from .target_tasks import get_method
|
||||
|
||||
ARTIFACTS_DIR = 'artifacts'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# For each project, this gives a set of parameters specific to the project.
|
||||
# See `taskcluster/docs/parameters.rst` for information on parameters.
|
||||
PER_PROJECT_PARAMETERS = {
|
||||
'try': {
|
||||
'target_tasks_method': 'try_option_syntax',
|
||||
},
|
||||
|
||||
# the default parameters are used for projects that do not match above.
|
||||
'default': {
|
||||
'target_tasks_method': 'all_tasks',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def taskgraph_decision(log, options):
|
||||
"""
|
||||
@ -64,6 +79,38 @@ def taskgraph_decision(log, options):
|
||||
create_tasks(tgg.optimized_task_graph)
|
||||
|
||||
|
||||
def get_decision_parameters(options):
|
||||
"""
|
||||
Load parameters from the command-line options for 'taskgraph decision'.
|
||||
This also applies per-project parameters, based on the given project.
|
||||
|
||||
"""
|
||||
parameters = {n: options[n] for n in [
|
||||
'base_repository',
|
||||
'head_repository',
|
||||
'head_rev',
|
||||
'head_ref',
|
||||
'revision_hash',
|
||||
'message',
|
||||
'project',
|
||||
'pushlog_id',
|
||||
'owner',
|
||||
'level',
|
||||
'target_tasks_method',
|
||||
] if n in options}
|
||||
|
||||
project = parameters['project']
|
||||
try:
|
||||
parameters.update(PER_PROJECT_PARAMETERS[project])
|
||||
except KeyError:
|
||||
logger.warning("using default project parameters; add {} to "
|
||||
"PER_PROJECT_PARAMETERS in {} to customize behavior "
|
||||
"for this project".format(project, __file__))
|
||||
parameters.update(PER_PROJECT_PARAMETERS['default'])
|
||||
|
||||
return Parameters(parameters)
|
||||
|
||||
|
||||
def taskgraph_to_json(taskgraph):
|
||||
tasks = taskgraph.tasks
|
||||
|
||||
|
@ -34,21 +34,3 @@ def load_parameters_file(options):
|
||||
return Parameters(**json.load(f))
|
||||
else:
|
||||
raise TypeError("Parameters file `{}` is not JSON or YAML".format(filename))
|
||||
|
||||
def get_decision_parameters(options):
|
||||
"""
|
||||
Load parameters from the command-line options for 'taskgraph decision'.
|
||||
"""
|
||||
return Parameters({n: options[n] for n in [
|
||||
'base_repository',
|
||||
'head_repository',
|
||||
'head_rev',
|
||||
'head_ref',
|
||||
'revision_hash',
|
||||
'message',
|
||||
'project',
|
||||
'pushlog_id',
|
||||
'owner',
|
||||
'level',
|
||||
'target_tasks_method',
|
||||
] if n in options})
|
||||
|
Loading…
Reference in New Issue
Block a user