Backed out 3 changesets (bug 1870106, bug 1845276) for causing doc generate failures...
[gecko.git] / taskcluster / gecko_taskgraph / transforms / merge_automation.py
blobca5f3b6bde4867da4c9ffbd02a9cdbaf5f964ca7
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 """
5 Transform the update generation task into an actual task description.
6 """
8 from taskgraph.transforms.base import TransformSequence
9 from taskgraph.util.schema import resolve_keyed_by
11 transforms = TransformSequence()
14 @transforms.add
15 def handle_keyed_by(config, tasks):
16 """Resolve fields that can be keyed by platform, etc."""
17 if "merge_config" not in config.params:
18 return
19 merge_config = config.params["merge_config"]
20 fields = [
21 "worker.push",
22 "worker-type",
23 "worker.l10n-bump-info",
24 "worker.source-repo",
26 for task in tasks:
27 for field in fields:
28 resolve_keyed_by(
29 task,
30 field,
31 item_name=task["name"],
32 **{
33 "project": config.params["project"],
34 "release-type": config.params["release_type"],
35 "behavior": merge_config["behavior"],
38 yield task
41 @transforms.add
42 def update_labels(config, tasks):
43 for task in tasks:
44 merge_config = config.params["merge_config"]
45 task["label"] = "merge-{}".format(merge_config["behavior"])
46 treeherder = task.get("treeherder", {})
47 treeherder["symbol"] = "Rel({})".format(merge_config["behavior"])
48 task["treeherder"] = treeherder
49 yield task
52 @transforms.add
53 def add_payload_config(config, tasks):
54 for task in tasks:
55 if "merge_config" not in config.params:
56 break
57 merge_config = config.params["merge_config"]
58 worker = task["worker"]
59 worker["merge-info"] = config.graph_config["merge-automation"]["behaviors"][
60 merge_config["behavior"]
63 if "l10n-bump-info" in worker and worker["l10n-bump-info"] is None:
64 del worker["l10n-bump-info"]
66 # Override defaults, useful for testing.
67 for field in [
68 "from-repo",
69 "from-branch",
70 "to-repo",
71 "to-branch",
72 "fetch-version-from",
74 if merge_config.get(field):
75 worker["merge-info"][field] = merge_config[field]
77 worker["force-dry-run"] = merge_config["force-dry-run"]
78 worker["ssh-user"] = merge_config.get("ssh-user-alias", "merge_user")
79 if merge_config.get("push"):
80 worker["push"] = merge_config["push"]
81 yield task