summaryrefslogtreecommitdiffstats
path: root/taskcluster/taskgraph/transforms/code_review.py
diff options
context:
space:
mode:
Diffstat (limited to 'taskcluster/taskgraph/transforms/code_review.py')
-rw-r--r--taskcluster/taskgraph/transforms/code_review.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/taskcluster/taskgraph/transforms/code_review.py b/taskcluster/taskgraph/transforms/code_review.py
new file mode 100644
index 0000000000..53e01d3683
--- /dev/null
+++ b/taskcluster/taskgraph/transforms/code_review.py
@@ -0,0 +1,34 @@
+# 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/.
+"""
+Add soft dependencies and configuration to code-review tasks.
+"""
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+from taskgraph.transforms.base import TransformSequence
+
+transforms = TransformSequence()
+
+
+@transforms.add
+def add_dependencies(config, jobs):
+ for job in jobs:
+ job.setdefault("soft-dependencies", [])
+ job["soft-dependencies"] += [
+ dep_task.label
+ for dep_task in config.kind_dependencies_tasks.values()
+ if dep_task.attributes.get("code-review") is True
+ ]
+ yield job
+
+
+@transforms.add
+def add_phabricator_config(config, jobs):
+ for job in jobs:
+ diff = config.params.get("phabricator_diff")
+ if diff is not None:
+ code_review = job.setdefault("extra", {}).setdefault("code-review", {})
+ code_review["phabricator-diff"] = diff
+ yield job