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/.
6 from gecko_taskgraph
.transforms
.task
import payload_builder
7 from taskgraph
.util
.schema
import taskref_or_string
8 from voluptuous
import Any
, Optional
, Required
12 "scriptworker-beetmover",
14 Required("action"): str,
15 Required("version"): str,
16 Required("artifact-map"): [
20 Required("destinations"): [str],
23 Required("taskId"): taskref_or_string
,
26 Required("beetmover-application-name"): str,
27 Required("bucket"): str,
28 Required("upstream-artifacts"): [
30 Required("taskId"): taskref_or_string
,
31 Required("taskType"): str,
32 Required("paths"): [str],
37 def build_scriptworker_beetmover_payload(config
, task
, task_def
):
38 worker
= task
["worker"]
40 task_def
["tags"]["worker-implementation"] = "scriptworker"
42 # Needed by beetmover-scriptworker
43 for map_
in worker
["artifact-map"]:
44 map_
["locale"] = "en-US"
45 for path_config
in map_
["paths"].values():
46 path_config
["checksums_path"] = ""
48 task_def
["payload"] = {
49 "artifactMap": worker
["artifact-map"],
50 "releaseProperties": {"appName": worker
.pop("beetmover-application-name")},
51 "upstreamArtifacts": worker
["upstream-artifacts"],
52 "version": worker
["version"],
55 scope_prefix
= config
.graph_config
["scriptworker"]["scope-prefix"]
56 task_def
["scopes"].extend(
58 "{}:beetmover:action:{}".format(scope_prefix
, worker
["action"]),
59 "{}:beetmover:bucket:{}".format(scope_prefix
, worker
["bucket"]),
65 "scriptworker-pushapk",
67 Required("upstream-artifacts"): [
69 Required("taskId"): taskref_or_string
,
70 Required("taskType"): str,
71 Required("paths"): [str],
74 Required("certificate-alias"): str,
75 Required("channel"): str,
76 Required("commit"): bool,
77 Required("product"): str,
78 Required("dep"): bool,
81 def build_push_apk_payload(config
, task
, task_def
):
82 worker
= task
["worker"]
84 task_def
["tags"]["worker-implementation"] = "scriptworker"
86 task_def
["payload"] = {
87 "certificate_alias": worker
["certificate-alias"],
88 "channel": worker
["channel"],
89 "commit": worker
["commit"],
90 "upstreamArtifacts": worker
["upstream-artifacts"],
93 scope_prefix
= config
.graph_config
["scriptworker"]["scope-prefix"]
94 task_def
["scopes"].append(
95 "{}:googleplay:product:{}{}".format(
96 scope_prefix
, worker
["product"], ":dep" if worker
["dep"] else ""
102 "scriptworker-shipit",
104 Required("release-name"): str,
107 def build_shipit_payload(config
, task
, task_def
):
108 worker
= task
["worker"]
110 task_def
["tags"]["worker-implementation"] = "scriptworker"
112 task_def
["payload"] = {"release_name": worker
["release-name"]}
118 Optional("upstream-artifacts"): [
120 Optional("taskId"): taskref_or_string
,
121 Optional("taskType"): str,
122 Optional("paths"): [str],
125 Required("bump"): bool,
126 Optional("bump-files"): [str],
127 Optional("push"): bool,
128 Optional("branch"): str,
131 def build_version_bump_payload(config
, task
, task_def
):
132 worker
= task
["worker"]
133 task_def
["tags"]["worker-implementation"] = "scriptworker"
135 scopes
= task_def
.setdefault("scopes", [])
136 scope_prefix
= f
"project:mobile:{config.params['project']}:treescript:action"
137 task_def
["payload"] = {}
140 if not worker
["bump-files"]:
141 raise Exception("Version Bump requested without bump-files")
144 bump_info
["next_version"] = config
.params
["next_version"]
145 bump_info
["files"] = worker
["bump-files"]
146 task_def
["payload"]["version_bump_info"] = bump_info
147 scopes
.append(f
"{scope_prefix}:version_bump")
150 task_def
["payload"]["push"] = True
152 if worker
.get("force-dry-run"):
153 task_def
["payload"]["dry_run"] = True
155 if worker
.get("branch"):
156 task_def
["payload"]["branch"] = worker
["branch"]