Bug 1609987 - Initial support for extending taskgraph with hooks. r=darktrojan
The comm_taskgraph.register function will get called early in the Decision
task. The Fenix project uses this to add functionality in key places via
hooks that aid in customizing the taskgraph.
This is just initial support, extension modules will be added as needed.
--- a/build/virtualenv_packages.txt
+++ b/build/virtualenv_packages.txt
@@ -1,2 +1,1 @@
-comm.pth:comm/taskcluster
comm.pth:comm/testing/marionette
--- a/taskcluster/ci/config.yml
+++ b/taskcluster/ci/config.yml
@@ -81,16 +81,19 @@ partner-urls:
task-priority:
by-project:
'comm-esr68': 'very-high'
'comm-beta': 'high'
'comm-central': 'medium'
'default': 'low'
+taskgraph:
+ register: comm_taskgraph:register
+
workers:
aliases:
b-linux.*:
provisioner: 'comm-{level}'
implementation: docker-worker
os: linux
worker-type: '{alias}'
b-win2012:
--- a/taskcluster/comm_taskgraph/__init__.py
+++ b/taskcluster/comm_taskgraph/__init__.py
@@ -1,3 +1,29 @@
# 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
+
+import os
+import logging
+from importlib import import_module
+
+from taskgraph import GECKO
+
+logger = logging.getLogger(__name__)
+
+COMM = os.path.join(GECKO, 'comm')
+
+
+def register(graph_config):
+ """
+ Import all modules that are siblings of this one, triggering decorators in
+ the process.
+ """
+ logger.info("{} path registered".format(__name__))
+ _import_modules([])
+
+
+def _import_modules(modules):
+ for module in modules:
+ import_module(".{}".format(module), package=__name__)