mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1624763 - Enable custom actions to be defined in a repo. r=tomprince
This is a port of https://hg.mozilla.org/ci/taskgraph/rev/a61ab06c25222 to allow for custom actions in a project repo. Previously, registration of actions worked but did not run when triggered. Differential Revision: https://phabricator.services.mozilla.com/D68891 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
9f10b2a2a0
commit
f49e91e5fb
@ -305,6 +305,7 @@ def trigger_action_callback(task_group_id, task_id, input, callback, parameters,
|
|||||||
the action callback in testing mode, without actually creating tasks.
|
the action callback in testing mode, without actually creating tasks.
|
||||||
"""
|
"""
|
||||||
graph_config = load_graph_config(root)
|
graph_config = load_graph_config(root)
|
||||||
|
graph_config.register()
|
||||||
callbacks = _get_callbacks(graph_config)
|
callbacks = _get_callbacks(graph_config)
|
||||||
cb = callbacks.get(callback, None)
|
cb = callbacks.get(callback, None)
|
||||||
if not cb:
|
if not cb:
|
||||||
|
@ -138,10 +138,16 @@ class GraphConfig(object):
|
|||||||
Add the project's taskgraph directory to the python path, and register
|
Add the project's taskgraph directory to the python path, and register
|
||||||
any extensions present.
|
any extensions present.
|
||||||
"""
|
"""
|
||||||
|
modify_path = os.path.dirname(self.root_dir)
|
||||||
if GraphConfig._PATH_MODIFIED:
|
if GraphConfig._PATH_MODIFIED:
|
||||||
|
if GraphConfig._PATH_MODIFIED == modify_path:
|
||||||
|
# Already modified path with the same root_dir.
|
||||||
|
# We currently need to do this to enable actions to call
|
||||||
|
# taskgraph_decision, e.g. relpro.
|
||||||
|
return
|
||||||
raise Exception("Can't register multiple directories on python path.")
|
raise Exception("Can't register multiple directories on python path.")
|
||||||
GraphConfig._PATH_MODIFIED = True
|
GraphConfig._PATH_MODIFIED = modify_path
|
||||||
sys.path.insert(0, os.path.dirname(self.root_dir))
|
sys.path.insert(0, modify_path)
|
||||||
register_path = self['taskgraph'].get('register')
|
register_path = self['taskgraph'].get('register')
|
||||||
if register_path:
|
if register_path:
|
||||||
find_object(register_path)(self)
|
find_object(register_path)(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user