mozilla-taskgraph 3.1.1__tar.gz → 3.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/.pre-commit-config.yaml +4 -4
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/CHANGELOG.md +12 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/PKG-INFO +1 -1
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/pyproject.toml +1 -1
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/src/mozilla_taskgraph/util/signed_artifacts.py +2 -0
- mozilla_taskgraph-3.2.0/src/mozilla_taskgraph/worker_types.py +465 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/test/conftest.py +3 -2
- mozilla_taskgraph-3.2.0/test/test_worker_types.py +1117 -0
- mozilla_taskgraph-3.2.0/test/util/test_signed_artifacts.py +22 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/uv.lock +1 -1
- mozilla_taskgraph-3.1.1/src/mozilla_taskgraph/worker_types.py +0 -185
- mozilla_taskgraph-3.1.1/test/test_worker_types.py +0 -465
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/.codespell-ignore-words.txt +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/.github/workflows/pre-commit-autoupdate.yml +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/.github/workflows/pre-commit.yml +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/.github/workflows/pypi-publish.yml +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/.gitignore +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/.readthedocs.yml +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/.taskcluster.yml +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/.yamllint +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/CODE_OF_CONDUCT.md +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/CONTRIBUTING.md +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/LICENSE +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/Makefile +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/README.md +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/docs/actions/index.rst +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/docs/actions/release-promotion.rst +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/docs/conf.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/docs/index.rst +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/docs/transforms/index.rst +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/docs/transforms/scriptworker/index.rst +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/docs/transforms/scriptworker/release_artifacts.rst +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/docs/transforms/scriptworker/ship-it.rst +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/src/mozilla_taskgraph/__init__.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/src/mozilla_taskgraph/actions/__init__.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/src/mozilla_taskgraph/actions/release_promotion.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/src/mozilla_taskgraph/config.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/src/mozilla_taskgraph/transforms/__init__.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/src/mozilla_taskgraph/transforms/scriptworker/__init__.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/src/mozilla_taskgraph/transforms/scriptworker/release_artifacts.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/src/mozilla_taskgraph/transforms/scriptworker/shipit/__init__.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/src/mozilla_taskgraph/transforms/scriptworker/shipit/mark_as_shipped.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/src/mozilla_taskgraph/version.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/taskcluster/config.yml +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/taskcluster/docker/fetch/Dockerfile +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/taskcluster/docker/fetch/REGISTRY +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/taskcluster/docker/python/Dockerfile +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/taskcluster/kinds/check/kind.yml +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/taskcluster/kinds/codecov/kind.yml +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/taskcluster/kinds/docker-image/kind.yml +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/taskcluster/kinds/fetch/kind.yml +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/taskcluster/kinds/release-promotion-dummy/kind.yml +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/taskcluster/kinds/test/kind.yml +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/taskcluster/mt_taskgraph/target_tasks.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/taskcluster/mt_taskgraph/transforms/test.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/taskcluster/scripts/codecov-upload.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/test/__init__.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/test/actions/__init__.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/test/actions/test_release_promotion.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/test/data/taskcluster/config.yml +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/test/data/testver.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/test/test_register.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/test/test_version.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/test/transforms/test_scriptworker_release_artifacts.py +0 -0
- {mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/test/transforms/test_scriptworker_shipit.py +0 -0
|
@@ -13,11 +13,11 @@ repos:
|
|
|
13
13
|
exclude: template
|
|
14
14
|
- id: check-added-large-files
|
|
15
15
|
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
16
|
-
rev: 0.7.
|
|
16
|
+
rev: 0.7.9
|
|
17
17
|
hooks:
|
|
18
18
|
- id: uv-lock
|
|
19
19
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
20
|
-
rev: 'v0.11.
|
|
20
|
+
rev: 'v0.11.12'
|
|
21
21
|
hooks:
|
|
22
22
|
- id: ruff
|
|
23
23
|
args: [--fix, --exit-non-zero-on-fix]
|
|
@@ -26,7 +26,7 @@ repos:
|
|
|
26
26
|
hooks:
|
|
27
27
|
- id: black
|
|
28
28
|
- repo: https://github.com/adrienverge/yamllint.git
|
|
29
|
-
rev: v1.37.
|
|
29
|
+
rev: v1.37.1
|
|
30
30
|
hooks:
|
|
31
31
|
- id: yamllint
|
|
32
32
|
exclude: template
|
|
@@ -40,7 +40,7 @@ repos:
|
|
|
40
40
|
test/test_util_path.py
|
|
41
41
|
)$
|
|
42
42
|
- repo: https://github.com/compilerla/conventional-pre-commit
|
|
43
|
-
rev: v4.
|
|
43
|
+
rev: v4.2.0
|
|
44
44
|
hooks:
|
|
45
45
|
- id: conventional-pre-commit
|
|
46
46
|
stages: [commit-msg]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mozilla-taskgraph
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.2.0
|
|
4
4
|
Summary: Mozilla specific transforms and utilities for Taskgraph
|
|
5
5
|
Project-URL: Repository, https://github.com/mozilla-releng/mozilla-taskgraph
|
|
6
6
|
Project-URL: Issues, https://github.com/mozilla-releng/mozilla-taskgraph/issues
|
{mozilla_taskgraph-3.1.1 → mozilla_taskgraph-3.2.0}/src/mozilla_taskgraph/util/signed_artifacts.py
RENAMED
|
@@ -10,6 +10,8 @@ def get_signed_artifacts(input, formats, behavior=None):
|
|
|
10
10
|
artifacts = set()
|
|
11
11
|
if input.endswith(".dmg"):
|
|
12
12
|
artifacts.add(input.replace(".dmg", ".tar.gz"))
|
|
13
|
+
if behavior and behavior != "mac_sign":
|
|
14
|
+
artifacts.add(input.replace(".dmg", ".pkg"))
|
|
13
15
|
else:
|
|
14
16
|
artifacts.add(input)
|
|
15
17
|
|
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
from taskgraph.transforms.task import payload_builder, taskref_or_string
|
|
2
|
+
from voluptuous import Any, Extra, Optional, Required
|
|
3
|
+
|
|
4
|
+
from mozilla_taskgraph.util.signed_artifacts import get_signed_artifacts
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@payload_builder(
|
|
8
|
+
"scriptworker-bitrise",
|
|
9
|
+
schema={
|
|
10
|
+
Required("bitrise"): {
|
|
11
|
+
Required(
|
|
12
|
+
"app", description="Name of Bitrise App to schedule workflows on."
|
|
13
|
+
): str,
|
|
14
|
+
Required(
|
|
15
|
+
"workflows",
|
|
16
|
+
description="List of workflows to trigger on specified app. "
|
|
17
|
+
"Can also be an object that maps workflow_ids to environment variables.",
|
|
18
|
+
): [
|
|
19
|
+
Any(
|
|
20
|
+
# Workflow id - no special environment variable
|
|
21
|
+
str,
|
|
22
|
+
# Map of workflow id to permutations of environment variables
|
|
23
|
+
{str: [{str: taskref_or_string}]},
|
|
24
|
+
)
|
|
25
|
+
],
|
|
26
|
+
Optional(
|
|
27
|
+
"artifact_prefix",
|
|
28
|
+
description="Directory prefix to store artifacts. Set this to 'public' "
|
|
29
|
+
"to create public artifacts.",
|
|
30
|
+
): str,
|
|
31
|
+
},
|
|
32
|
+
Extra: object,
|
|
33
|
+
},
|
|
34
|
+
)
|
|
35
|
+
def build_bitrise_payload(config, task, task_def):
|
|
36
|
+
bitrise = task["worker"]["bitrise"]
|
|
37
|
+
task_def["tags"]["worker-implementation"] = "scriptworker"
|
|
38
|
+
|
|
39
|
+
# Normalize environment variables to bitrise's format.
|
|
40
|
+
workflow_permutations = {}
|
|
41
|
+
for workflow in bitrise["workflows"]:
|
|
42
|
+
if isinstance(workflow, str):
|
|
43
|
+
# Empty environments
|
|
44
|
+
continue
|
|
45
|
+
for workflow_id, env_permutations in workflow.items():
|
|
46
|
+
workflow_permutations.setdefault(workflow_id, [])
|
|
47
|
+
for envs in env_permutations:
|
|
48
|
+
workflow_permutations[workflow_id].append(
|
|
49
|
+
{
|
|
50
|
+
"environments": [
|
|
51
|
+
{"mapped_to": k, "value": v} for k, v in envs.items()
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
def get_workflow_ids():
|
|
57
|
+
ids = []
|
|
58
|
+
for w in bitrise["workflows"]:
|
|
59
|
+
if isinstance(w, str):
|
|
60
|
+
ids.append(w)
|
|
61
|
+
else:
|
|
62
|
+
ids.extend(w.keys())
|
|
63
|
+
ids = list(set(ids)) # Unique only
|
|
64
|
+
ids.sort() # sorted to allow for proper unit testing
|
|
65
|
+
return ids
|
|
66
|
+
|
|
67
|
+
scope_prefix = config.graph_config["scriptworker"]["scope-prefix"]
|
|
68
|
+
scopes = task_def.setdefault("scopes", [])
|
|
69
|
+
scopes.append(f"{scope_prefix}:bitrise:app:{bitrise['app']}")
|
|
70
|
+
scopes.extend(
|
|
71
|
+
[f"{scope_prefix}:bitrise:workflow:{wf}" for wf in get_workflow_ids()]
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
def normref(ref, type="heads"):
|
|
75
|
+
if ref:
|
|
76
|
+
prefix = f"refs/{type}/"
|
|
77
|
+
if ref.startswith(prefix):
|
|
78
|
+
return ref[len(prefix) :]
|
|
79
|
+
# The ref is a different type than the requested one, return None
|
|
80
|
+
# to indicate this.
|
|
81
|
+
elif ref.startswith("refs/"):
|
|
82
|
+
return None
|
|
83
|
+
return ref
|
|
84
|
+
|
|
85
|
+
# Set some global_params implicitly from Taskcluster params.
|
|
86
|
+
global_params = {
|
|
87
|
+
"commit_hash": config.params["head_rev"],
|
|
88
|
+
"branch_repo_owner": config.params["head_repository"],
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if head_ref := normref(config.params["head_ref"]):
|
|
92
|
+
global_params["branch"] = head_ref
|
|
93
|
+
|
|
94
|
+
if head_tag := normref(config.params["head_tag"], type="tags"):
|
|
95
|
+
global_params["tag"] = head_tag
|
|
96
|
+
|
|
97
|
+
if commit_message := config.params.get("commit_message"):
|
|
98
|
+
global_params["commit_message"] = commit_message
|
|
99
|
+
|
|
100
|
+
if pull_request_number := config.params.get("pull_request_number"):
|
|
101
|
+
global_params["pull_request_id"] = pull_request_number
|
|
102
|
+
|
|
103
|
+
if config.params["tasks_for"] == "github-pull-request":
|
|
104
|
+
global_params["pull_request_author"] = config.params["owner"]
|
|
105
|
+
|
|
106
|
+
if base_ref := normref(config.params["base_ref"]):
|
|
107
|
+
global_params["branch_dest"] = base_ref
|
|
108
|
+
|
|
109
|
+
if base_repository := config.params["base_repository"]:
|
|
110
|
+
global_params["branch_dest_repo_owner"] = base_repository
|
|
111
|
+
|
|
112
|
+
task_def["payload"] = {"global_params": global_params}
|
|
113
|
+
if workflow_permutations:
|
|
114
|
+
task_def["payload"]["workflow_params"] = workflow_permutations
|
|
115
|
+
|
|
116
|
+
if bitrise.get("artifact_prefix"):
|
|
117
|
+
task_def["payload"]["artifact_prefix"] = bitrise["artifact_prefix"]
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
@payload_builder(
|
|
121
|
+
"scriptworker-shipit",
|
|
122
|
+
schema={
|
|
123
|
+
Required("release-name"): str,
|
|
124
|
+
},
|
|
125
|
+
)
|
|
126
|
+
def build_shipit_payload(config, task, task_def):
|
|
127
|
+
worker = task["worker"]
|
|
128
|
+
task_def["tags"]["worker-implementation"] = "scriptworker"
|
|
129
|
+
task_def["payload"] = {"release_name": worker["release-name"]}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@payload_builder(
|
|
133
|
+
"scriptworker-signing",
|
|
134
|
+
schema={
|
|
135
|
+
Required("signing-type"): str,
|
|
136
|
+
# list of artifact URLs for the artifacts that should be signed
|
|
137
|
+
Required("upstream-artifacts"): [
|
|
138
|
+
{
|
|
139
|
+
# taskId of the task with the artifact
|
|
140
|
+
Required("taskId"): taskref_or_string,
|
|
141
|
+
# type of signing task (for CoT)
|
|
142
|
+
Required("taskType"): str,
|
|
143
|
+
# Paths to the artifacts to sign
|
|
144
|
+
Required("paths"): [str],
|
|
145
|
+
# Signing formats to use on each of the paths
|
|
146
|
+
Required("formats"): [str],
|
|
147
|
+
# Only For MSI, optional for the signed Installer
|
|
148
|
+
Optional("authenticode_comment"): str,
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
Optional("max-run-time"): int,
|
|
152
|
+
},
|
|
153
|
+
)
|
|
154
|
+
def build_signing_payload(config, task, task_def):
|
|
155
|
+
worker = task["worker"]
|
|
156
|
+
|
|
157
|
+
task_def["payload"] = {
|
|
158
|
+
"upstreamArtifacts": worker["upstream-artifacts"],
|
|
159
|
+
}
|
|
160
|
+
if "max-run-time" in worker:
|
|
161
|
+
task_def["payload"]["maxRunTime"] = worker["max-run-time"]
|
|
162
|
+
|
|
163
|
+
task_def.setdefault("tags", {})["worker-implementation"] = "scriptworker"
|
|
164
|
+
|
|
165
|
+
formats = set()
|
|
166
|
+
for artifacts in worker["upstream-artifacts"]:
|
|
167
|
+
formats.update(artifacts["formats"])
|
|
168
|
+
|
|
169
|
+
scope_prefix = config.graph_config["scriptworker"]["scope-prefix"]
|
|
170
|
+
scopes = set(task_def.get("scopes", []))
|
|
171
|
+
scopes.add(f"{scope_prefix}:signing:cert:{worker['signing-type']}")
|
|
172
|
+
|
|
173
|
+
task_def["scopes"] = sorted(scopes)
|
|
174
|
+
|
|
175
|
+
# Set release artifacts
|
|
176
|
+
artifacts = set(task.setdefault("attributes", {}).get("release_artifacts", []))
|
|
177
|
+
for upstream_artifact in worker["upstream-artifacts"]:
|
|
178
|
+
for path in upstream_artifact["paths"]:
|
|
179
|
+
artifacts.update(
|
|
180
|
+
get_signed_artifacts(
|
|
181
|
+
input=path,
|
|
182
|
+
formats=upstream_artifact["formats"],
|
|
183
|
+
)
|
|
184
|
+
)
|
|
185
|
+
task["attributes"]["release_artifacts"] = sorted(list(artifacts))
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
l10n_bump_info_schema = [
|
|
189
|
+
{
|
|
190
|
+
Required("name"): str,
|
|
191
|
+
Required("path"): str,
|
|
192
|
+
Required("l10n-repo-url"): str,
|
|
193
|
+
Required("l10n-repo-target-branch"): str,
|
|
194
|
+
Optional("ignore-config"): object,
|
|
195
|
+
Required("platform-configs"): [
|
|
196
|
+
{
|
|
197
|
+
Required("platforms"): [str],
|
|
198
|
+
Required("path"): str,
|
|
199
|
+
Optional("format"): str,
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def process_l10n_bump_info(info):
|
|
207
|
+
l10n_bump_info = []
|
|
208
|
+
l10n_repo_urls = set()
|
|
209
|
+
for lbi in info:
|
|
210
|
+
l10n_repo_urls.add(lbi["l10n-repo-url"])
|
|
211
|
+
l10n_bump_info.append(dash_to_underscore(lbi))
|
|
212
|
+
|
|
213
|
+
if len(l10n_repo_urls) > 1:
|
|
214
|
+
raise Exception(
|
|
215
|
+
"Must use the same l10n-repo-url for all files in the same task!"
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
return l10n_bump_info
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
@payload_builder(
|
|
222
|
+
"scriptworker-lando",
|
|
223
|
+
schema={
|
|
224
|
+
Required("lando-repo"): str,
|
|
225
|
+
Required("actions"): [
|
|
226
|
+
Any(
|
|
227
|
+
{
|
|
228
|
+
Required("android-l10n-sync"): {
|
|
229
|
+
Required("from-branch"): str,
|
|
230
|
+
Required("toml-info"): [
|
|
231
|
+
{
|
|
232
|
+
Required("toml-path"): str,
|
|
233
|
+
}
|
|
234
|
+
],
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
Required("android-l10n-import"): {
|
|
239
|
+
Required("from-repo-url"): str,
|
|
240
|
+
Required("toml-info"): [
|
|
241
|
+
{
|
|
242
|
+
Required("toml-path"): str,
|
|
243
|
+
Required("dest-path"): str,
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
Required("l10n-bump"): l10n_bump_info_schema,
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
Required("tag"): {
|
|
253
|
+
Required("types"): [Any("buildN", "release")],
|
|
254
|
+
Required("hg-repo-url"): str,
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
Required("version-bump"): {
|
|
259
|
+
Required("bump-files"): [str],
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
# the remaining action types all end up using the "merge_day"
|
|
263
|
+
# landoscript action. however, these are quite varied tasks,
|
|
264
|
+
# and separating them out allows us to have stronger schemas.
|
|
265
|
+
{
|
|
266
|
+
Required("esr-bump"): {
|
|
267
|
+
Required("to-branch"): str,
|
|
268
|
+
Required("fetch-version-from"): str,
|
|
269
|
+
Required("version-files"): [
|
|
270
|
+
{
|
|
271
|
+
Required("filename"): str,
|
|
272
|
+
Required("version-bump"): str,
|
|
273
|
+
Optional("new-suffix"): str,
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
Required("main-bump"): {
|
|
280
|
+
Required("to-branch"): str,
|
|
281
|
+
Required("fetch-version-from"): str,
|
|
282
|
+
Required("version-files"): [
|
|
283
|
+
{
|
|
284
|
+
Required("filename"): str,
|
|
285
|
+
Required("version-bump"): str,
|
|
286
|
+
Optional("new-suffix"): str,
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
Optional("replacements"): [[str]],
|
|
290
|
+
Optional("regex-replacements"): [[str]],
|
|
291
|
+
Optional("end-tag"): str,
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
Required("early-to-late-beta"): {
|
|
296
|
+
Required("to-branch"): str,
|
|
297
|
+
Optional("replacements"): [[str]],
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
Required("uplift"): {
|
|
302
|
+
Required("fetch-version-from"): str,
|
|
303
|
+
Required("version-files"): [
|
|
304
|
+
{
|
|
305
|
+
Required("filename"): str,
|
|
306
|
+
Optional("version-bump"): str,
|
|
307
|
+
Optional("new-suffix"): str,
|
|
308
|
+
},
|
|
309
|
+
],
|
|
310
|
+
Required("from-branch"): str,
|
|
311
|
+
Required("to-branch"): str,
|
|
312
|
+
Optional("replacements"): [[str]],
|
|
313
|
+
Optional("base-tag"): str,
|
|
314
|
+
Optional("end-tag"): str,
|
|
315
|
+
Optional("l10n-bump-info"): l10n_bump_info_schema,
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
)
|
|
319
|
+
],
|
|
320
|
+
Optional("ignore-closed-tree"): bool,
|
|
321
|
+
Optional("dontbuild"): bool,
|
|
322
|
+
Optional("force-dry-run"): bool,
|
|
323
|
+
Optional("matrix-rooms"): [str],
|
|
324
|
+
},
|
|
325
|
+
)
|
|
326
|
+
def build_lando_payload(config, task, task_def):
|
|
327
|
+
worker = task["worker"]
|
|
328
|
+
release_config = get_release_config(config)
|
|
329
|
+
task_def["payload"] = {"actions": [], "lando_repo": worker["lando-repo"]}
|
|
330
|
+
task_def["tags"]["worker-implementation"] = "scriptworker"
|
|
331
|
+
actions = task_def["payload"]["actions"]
|
|
332
|
+
|
|
333
|
+
if worker.get("ignore-closed-tree") is not None:
|
|
334
|
+
task_def["payload"]["ignore_closed_tree"] = worker["ignore-closed-tree"]
|
|
335
|
+
|
|
336
|
+
if worker.get("dontbuild"):
|
|
337
|
+
task_def["payload"]["dontbuild"] = True
|
|
338
|
+
|
|
339
|
+
if worker.get("force-dry-run"):
|
|
340
|
+
task_def["payload"]["dry_run"] = True
|
|
341
|
+
|
|
342
|
+
for action in worker["actions"]:
|
|
343
|
+
if info := action.get("android-l10n-import"):
|
|
344
|
+
android_l10n_import_info = dash_to_underscore(info)
|
|
345
|
+
android_l10n_import_info["toml_info"] = [
|
|
346
|
+
dash_to_underscore(ti) for ti in android_l10n_import_info["toml_info"]
|
|
347
|
+
]
|
|
348
|
+
task_def["payload"]["android_l10n_import_info"] = android_l10n_import_info
|
|
349
|
+
actions.append("android_l10n_import")
|
|
350
|
+
|
|
351
|
+
if info := action.get("android-l10n-sync"):
|
|
352
|
+
android_l10n_sync_info = dash_to_underscore(info)
|
|
353
|
+
android_l10n_sync_info["toml_info"] = [
|
|
354
|
+
dash_to_underscore(ti) for ti in android_l10n_sync_info["toml_info"]
|
|
355
|
+
]
|
|
356
|
+
task_def["payload"]["android_l10n_sync_info"] = android_l10n_sync_info
|
|
357
|
+
actions.append("android_l10n_sync")
|
|
358
|
+
|
|
359
|
+
if info := action.get("l10n-bump"):
|
|
360
|
+
task_def["payload"]["l10n_bump_info"] = process_l10n_bump_info(info)
|
|
361
|
+
actions.append("l10n_bump")
|
|
362
|
+
|
|
363
|
+
if info := action.get("tag"):
|
|
364
|
+
tag_types = info["types"]
|
|
365
|
+
tag_names = []
|
|
366
|
+
product = task["shipping-product"].upper()
|
|
367
|
+
version = release_config["version"].replace(".", "_")
|
|
368
|
+
buildnum = release_config["build_number"]
|
|
369
|
+
if "buildN" in tag_types:
|
|
370
|
+
tag_names.extend(
|
|
371
|
+
[
|
|
372
|
+
f"{product}_{version}_BUILD{buildnum}",
|
|
373
|
+
]
|
|
374
|
+
)
|
|
375
|
+
if "release" in tag_types:
|
|
376
|
+
tag_names.extend([f"{product}_{version}_RELEASE"])
|
|
377
|
+
tag_info = {
|
|
378
|
+
"tags": tag_names,
|
|
379
|
+
"hg_repo_url": info["hg-repo-url"],
|
|
380
|
+
"revision": config.params[
|
|
381
|
+
"{}head_rev".format(worker.get("repo-param-prefix", ""))
|
|
382
|
+
],
|
|
383
|
+
}
|
|
384
|
+
task_def["payload"]["tag_info"] = tag_info
|
|
385
|
+
actions.append("tag")
|
|
386
|
+
|
|
387
|
+
if info := action.get("version-bump"):
|
|
388
|
+
bump_info = {}
|
|
389
|
+
bump_info["next_version"] = release_config["next_version"]
|
|
390
|
+
bump_info["files"] = info["bump-files"]
|
|
391
|
+
task_def["payload"]["version_bump_info"] = bump_info
|
|
392
|
+
actions.append("version_bump")
|
|
393
|
+
|
|
394
|
+
if info := action.get("esr-bump"):
|
|
395
|
+
merge_info = dash_to_underscore(info)
|
|
396
|
+
merge_info["version_files"] = [
|
|
397
|
+
dash_to_underscore(vf) for vf in info["version-files"]
|
|
398
|
+
]
|
|
399
|
+
task_def["payload"]["merge_info"] = merge_info
|
|
400
|
+
actions.append("merge_day")
|
|
401
|
+
|
|
402
|
+
if info := action.get("main-bump"):
|
|
403
|
+
merge_info = dash_to_underscore(info)
|
|
404
|
+
|
|
405
|
+
merge_info["version_files"] = [
|
|
406
|
+
dash_to_underscore(vf) for vf in info["version-files"]
|
|
407
|
+
]
|
|
408
|
+
task_def["payload"]["merge_info"] = merge_info
|
|
409
|
+
actions.append("merge_day")
|
|
410
|
+
|
|
411
|
+
if info := action.get("early-to-late-beta"):
|
|
412
|
+
task_def["payload"]["merge_info"] = dash_to_underscore(info)
|
|
413
|
+
actions.append("merge_day")
|
|
414
|
+
|
|
415
|
+
if info := action.get("uplift"):
|
|
416
|
+
merge_info = dash_to_underscore(info)
|
|
417
|
+
merge_info["merge_old_head"] = True
|
|
418
|
+
|
|
419
|
+
merge_info["version_files"] = [
|
|
420
|
+
dash_to_underscore(vf) for vf in info["version-files"]
|
|
421
|
+
]
|
|
422
|
+
if lbi := info.get("l10n-bump-info"):
|
|
423
|
+
merge_info["l10n_bump_info"] = process_l10n_bump_info(lbi)
|
|
424
|
+
|
|
425
|
+
task_def["payload"]["merge_info"] = merge_info
|
|
426
|
+
actions.append("merge_day")
|
|
427
|
+
|
|
428
|
+
scopes = set(task_def.get("scopes", []))
|
|
429
|
+
scopes.add(f"project:releng:lando:repo:{worker['lando-repo']}")
|
|
430
|
+
scopes.update([f"project:releng:lando:action:{action}" for action in actions])
|
|
431
|
+
|
|
432
|
+
for matrix_room in worker.get("matrix-rooms", []):
|
|
433
|
+
task_def.setdefault("routes", [])
|
|
434
|
+
task_def["routes"].append(f"notify.matrix-room.{matrix_room}.on-pending")
|
|
435
|
+
task_def["routes"].append(f"notify.matrix-room.{matrix_room}.on-resolved")
|
|
436
|
+
scopes.add("queue:route:notify.matrix-room.*")
|
|
437
|
+
|
|
438
|
+
task_def["scopes"] = sorted(scopes)
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
def get_release_config(config):
|
|
442
|
+
"""Get the build number and version for a release task.
|
|
443
|
+
|
|
444
|
+
Currently only applies to beetmover tasks.
|
|
445
|
+
|
|
446
|
+
Args:
|
|
447
|
+
config (TransformConfig): The configuration for the kind being transformed.
|
|
448
|
+
|
|
449
|
+
Returns:
|
|
450
|
+
dict: containing both `build_number` and `version`. This can be used to
|
|
451
|
+
update `task.payload`.
|
|
452
|
+
"""
|
|
453
|
+
return {
|
|
454
|
+
"version": config.params["version"],
|
|
455
|
+
"appVersion": config.params["app_version"],
|
|
456
|
+
"next_version": config.params["next_version"],
|
|
457
|
+
"build_number": config.params["build_number"],
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
def dash_to_underscore(obj):
|
|
462
|
+
new_obj = {}
|
|
463
|
+
for k, v in obj.items():
|
|
464
|
+
new_obj[k.replace("-", "_")] = v
|
|
465
|
+
return new_obj
|
|
@@ -74,6 +74,7 @@ class FakeParameters(dict):
|
|
|
74
74
|
def parameters():
|
|
75
75
|
return FakeParameters(
|
|
76
76
|
{
|
|
77
|
+
"app_version": "99.0",
|
|
77
78
|
"base_ref": "123456",
|
|
78
79
|
"base_repository": "http://example.com/base/repo",
|
|
79
80
|
"build_date": 0,
|
|
@@ -85,7 +86,7 @@ def parameters():
|
|
|
85
86
|
"head_tag": "",
|
|
86
87
|
"level": "1",
|
|
87
88
|
"moz_build_date": 0,
|
|
88
|
-
"next_version": "
|
|
89
|
+
"next_version": "100.0",
|
|
89
90
|
"owner": "some-owner",
|
|
90
91
|
"project": "some-project",
|
|
91
92
|
"pushlog_id": 1,
|
|
@@ -93,7 +94,7 @@ def parameters():
|
|
|
93
94
|
"target_tasks_method": "test_method",
|
|
94
95
|
"tasks_for": "hg-push",
|
|
95
96
|
"try_mode": None,
|
|
96
|
-
"version": "",
|
|
97
|
+
"version": "99.0",
|
|
97
98
|
}
|
|
98
99
|
)
|
|
99
100
|
|