Skip to content

Commit e40679f

Browse files
committed
Bug 1812480 - Switch mac pkg source to repackaged instead of iscript r=releng-reviewers,taskgraph-reviewers,ahal
Differential Revision: https://phabricator.services.mozilla.com/D291641
1 parent 9d0a9a9 commit e40679f

17 files changed

Lines changed: 354 additions & 27 deletions

File tree

‎taskcluster/config.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ treeherder:
104104
'L10n': 'Localised Repacks'
105105
'L10n-Rpk': 'Localized Repackaged Repacks'
106106
'deb-L10n': 'Localized Debian Repacks'
107+
'pkg-Rpk': 'MacOS pkg repackage'
107108
'BM': 'Beetmover'
108109
'BMR': 'Beetmover repackages'
109110
'BM-apt': 'Beetmover .deb packages'

‎taskcluster/docs/kinds.rst‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,22 @@ repackage-rpm-signing
615615
---------------------
616616
Repackage-rpm-signing takes the repackaged RPMs and signs them.
617617

618+
repackage-pkg-signing
619+
---------------------
620+
Repackage-pkg-signing takes the repackaged macOS .pkg installers and signs them.
621+
622+
repackage-pkg-notarization
623+
--------------------------
624+
Notarization of signed macOS .pkg installers via Apple's notarization service.
625+
626+
repackage-l10n-pkg-signing
627+
--------------------------
628+
Repackage-l10n-pkg-signing takes the l10n repackaged macOS .pkg installers and signs them.
629+
630+
repackage-l10n-pkg-notarization
631+
-------------------------------
632+
Notarization of signed macOS .pkg installers via Apple's notarization service.
633+
618634
repackage-flatpak
619635
-----------------
620636
These repackage tasks take signed Firefox Linux binaries and langpacks, and builds a flatpak.

‎taskcluster/gecko_taskgraph/manifests/firefox_candidates.yml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ tasktype_map:
5858
repackage-signing: repackage
5959
repackage-signing-msi: repackage
6060
repackage-signing-shippable-l10n-msix: signing
61+
repackage-pkg-notarization: signing
62+
repackage-l10n-pkg-notarization: signing
6163
langpack-copy: scriptworker
6264
attribution: build
6365
attribution-l10n: build
@@ -272,7 +274,13 @@ mapping:
272274
description: "Main package installer for Mac OS X platforms"
273275
all_locales: true
274276
from:
275-
- signing
277+
by-level:
278+
"3":
279+
- repackage-pkg-notarization
280+
- repackage-l10n-pkg-notarization
281+
default:
282+
- repackage
283+
- repackage-l10n
276284
only_for_platforms:
277285
- macosx64-shippable
278286
pretty_name: Firefox ${version}.pkg

‎taskcluster/gecko_taskgraph/manifests/firefox_nightly.yml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ tasktype_map:
5353
repackage-signing: repackage
5454
repackage-signing-msi: repackage
5555
repackage-signing-shippable-l10n-msix: signing
56+
repackage-pkg-notarization: signing
57+
repackage-l10n-pkg-notarization: signing
5658
langpack-copy: signing
5759
attribution: build
5860
attribution-l10n: build
@@ -285,7 +287,13 @@ mapping:
285287
description: "Main package installer for Mac OS X platforms"
286288
all_locales: true
287289
from:
288-
- signing
290+
by-level:
291+
"3":
292+
- repackage-pkg-notarization
293+
- repackage-l10n-pkg-notarization
294+
default:
295+
- repackage
296+
- repackage-l10n
289297
only_for_platforms:
290298
- macosx64-shippable
291299
pretty_name: firefox-${version}.${locale}.${filename_platform}.pkg

‎taskcluster/gecko_taskgraph/transforms/beetmover_repackage.py‎

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -147,25 +147,26 @@ def make_task_description(config, jobs):
147147
"build": upstream_deps[build_name],
148148
"signing": upstream_deps[signing_name],
149149
}
150-
if repackage_name in upstream_deps:
151-
dependencies["repackage"] = upstream_deps[repackage_name]
152-
if mar_signing_name in upstream_deps:
153-
dependencies["mar-signing"] = upstream_deps[mar_signing_name]
154-
if "partials-signing" in upstream_deps:
155-
dependencies["partials-signing"] = upstream_deps["partials-signing"]
156-
if msi_signing_name in upstream_deps:
157-
dependencies[msi_signing_name] = upstream_deps[msi_signing_name]
158-
if msix_signing_name in upstream_deps:
159-
dependencies[msix_signing_name] = upstream_deps[msix_signing_name]
160-
if repackage_signing_name in upstream_deps:
161-
dependencies["repackage-signing"] = upstream_deps[repackage_signing_name]
162-
if attribution_name in upstream_deps:
163-
dependencies[attribution_name] = upstream_deps[attribution_name]
164-
if repackage_deb_name in upstream_deps:
165-
dependencies[repackage_deb_name] = upstream_deps[repackage_deb_name]
166-
for kind in ("upload-symbols", "upload-symbols-dummy"):
167-
if kind in upstream_deps:
168-
dependencies[kind] = upstream_deps[kind]
150+
# Optional dependencies: (dep_key, upstream_name) pairs.
151+
# When the dep_key differs from the upstream name, the dependency is
152+
# aliased (e.g. repackage_name -> "repackage").
153+
optional_deps = [
154+
("repackage", repackage_name),
155+
("mar-signing", mar_signing_name),
156+
("partials-signing", "partials-signing"),
157+
(msi_signing_name, msi_signing_name),
158+
(msix_signing_name, msix_signing_name),
159+
("repackage-signing", repackage_signing_name),
160+
(attribution_name, attribution_name),
161+
(repackage_deb_name, repackage_deb_name),
162+
("repackage-pkg-notarization", "repackage-pkg-notarization"),
163+
("repackage-l10n-pkg-notarization", "repackage-l10n-pkg-notarization"),
164+
("upload-symbols", "upload-symbols"),
165+
("upload-symbols-dummy", "upload-symbols-dummy"),
166+
]
167+
for dep_key, upstream_name in optional_deps:
168+
if upstream_name in upstream_deps:
169+
dependencies[dep_key] = upstream_deps[upstream_name]
169170

170171
attributes = copy_attributes_from_dependent_job(dep_job)
171172
attributes.update(job.get("attributes", {}))
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
from taskgraph.transforms.base import TransformSequence
6+
from taskgraph.util.dependencies import get_primary_dependency
7+
from taskgraph.util.treeherder import join_symbol
8+
9+
from gecko_taskgraph.util.attributes import copy_attributes_from_dependent_job
10+
11+
transforms = TransformSequence()
12+
13+
14+
@transforms.add
15+
def treeherder(config, jobs):
16+
for job in jobs:
17+
dep_job = get_primary_dependency(config, job)
18+
19+
# Pop out the group from the treeherder definition
20+
group = job.get("treeherder", {}).pop("group", "pkg-Rpk")
21+
22+
# add the chunk number to the TH symbol
23+
symbol = job.get("treeherder", {}).get("symbol", "N")
24+
symbol = "{}{}".format(symbol, dep_job.attributes.get("l10n_chunk", ""))
25+
26+
job.setdefault("treeherder", {})["symbol"] = join_symbol(group, symbol)
27+
28+
yield job
29+
30+
31+
@transforms.add
32+
def define_upstream_artifacts(config, jobs):
33+
for job in jobs:
34+
dep_job = get_primary_dependency(config, job)
35+
36+
job.setdefault("attributes", {}).update(
37+
copy_attributes_from_dependent_job(dep_job)
38+
)
39+
if dep_job.attributes.get("chunk_locales"):
40+
job["attributes"]["chunk_locales"] = dep_job.attributes.get("chunk_locales")
41+
42+
paths = sorted(
43+
p
44+
for p in dep_job.attributes.get("release_artifacts", [])
45+
if p.endswith(".pkg")
46+
)
47+
48+
job["upstream-artifacts"] = [
49+
{
50+
"taskId": {"task-reference": f"<{dep_job.kind}>"},
51+
"taskType": "signing",
52+
"paths": paths,
53+
"formats": ["apple_notarization_stacked"],
54+
}
55+
]
56+
57+
job.pop("description", None)
58+
59+
yield job
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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+
from typing import Optional
6+
7+
from taskgraph.transforms.base import TransformSequence
8+
from taskgraph.util.dependencies import get_primary_dependency
9+
from taskgraph.util.schema import Schema
10+
from taskgraph.util.treeherder import inherit_treeherder_from_dep
11+
12+
from gecko_taskgraph.transforms.task import TaskDescriptionSchema
13+
from gecko_taskgraph.util.attributes import copy_attributes_from_dependent_job
14+
from gecko_taskgraph.util.scriptworker import get_signing_type_per_platform
15+
16+
17+
class RepackagePkgSigningSchema(Schema, kw_only=True):
18+
label: Optional[str] = None
19+
description: Optional[str] = None
20+
attributes: TaskDescriptionSchema.__annotations__["attributes"] = None
21+
dependencies: TaskDescriptionSchema.__annotations__["dependencies"] = None
22+
task_from: TaskDescriptionSchema.__annotations__["task_from"] = None
23+
treeherder: TaskDescriptionSchema.__annotations__["treeherder"] = None
24+
shipping_product: TaskDescriptionSchema.__annotations__["shipping_product"] = None
25+
shipping_phase: TaskDescriptionSchema.__annotations__["shipping_phase"] = None
26+
run_on_repo_type: TaskDescriptionSchema.__annotations__["run_on_repo_type"] = None
27+
28+
29+
transforms = TransformSequence()
30+
31+
32+
@transforms.add
33+
def remove_name(config, jobs):
34+
for job in jobs:
35+
if "name" in job:
36+
del job["name"]
37+
yield job
38+
39+
40+
transforms.add_validate(RepackagePkgSigningSchema)
41+
42+
43+
@transforms.add
44+
def make_task_description(config, tasks):
45+
for task in tasks:
46+
dep = get_primary_dependency(config, task)
47+
assert dep
48+
49+
# Collect all dependencies from this group. For en-US builds there is
50+
# a single dependency; for l10n builds each locale in the chunk is a
51+
# separate upstream repackage-l10n task.
52+
all_deps = [
53+
config.kind_dependencies_tasks[label]
54+
for label in task.get("dependencies", {}).values()
55+
if label in config.kind_dependencies_tasks
56+
]
57+
if not all_deps:
58+
all_deps = [dep]
59+
60+
upstream_artifacts = []
61+
dependencies = {}
62+
for d in all_deps:
63+
dep_key = d.label if len(all_deps) > 1 else d.kind
64+
dependencies[dep_key] = d.label
65+
dependencies.update(d.dependencies)
66+
for artifact in d.attributes.get("release_artifacts", []):
67+
if artifact.endswith(".pkg"):
68+
upstream_artifacts.append({
69+
"taskId": {"task-reference": f"<{dep_key}>"},
70+
"taskType": "repackage",
71+
"paths": [artifact],
72+
"formats": ["mac_single_file"],
73+
})
74+
75+
is_shippable = bool(dep.attributes.get("shippable"))
76+
77+
th = inherit_treeherder_from_dep(task, dep)
78+
l10n_chunk = dep.attributes.get("l10n_chunk", "")
79+
th["symbol"] = f"pkg-Rpk(S{l10n_chunk})"
80+
81+
# For chunked l10n tasks, override the label to use the chunk number
82+
# instead of the locale name that name_sanity generates.
83+
label = task["label"]
84+
if l10n_chunk:
85+
label = (
86+
f"{config.kind}-{dep.attributes['build_platform']}"
87+
f"-{l10n_chunk}/{dep.attributes['build_type']}"
88+
)
89+
90+
attributes = copy_attributes_from_dependent_job(dep)
91+
if len(all_deps) > 1:
92+
attributes["chunk_locales"] = sorted(
93+
d.attributes["locale"] for d in all_deps if d.attributes.get("locale")
94+
)
95+
96+
yield {
97+
"label": label,
98+
"description": f"MacOS pkg signing {l10n_chunk}".strip(),
99+
"worker-type": "mac-signing" if is_shippable else "mac-depsigning",
100+
"worker": {
101+
"signing-type": get_signing_type_per_platform(
102+
dep.attributes.get("build_platform"), is_shippable, config
103+
),
104+
"implementation": "iscript",
105+
"upstream-artifacts": upstream_artifacts,
106+
"mac-behavior": "mac_sign_pkg",
107+
},
108+
"dependencies": dependencies,
109+
"attributes": attributes,
110+
"run-on-projects": dep.attributes.get("run_on_projects"),
111+
"treeherder": th,
112+
}

‎taskcluster/gecko_taskgraph/transforms/signing.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ def make_task_description(config, jobs):
197197
if dep_job.kind in task["dependencies"]:
198198
task["if-dependencies"] = [dep_job.kind]
199199

200-
# build-mac-{signing,notarization} uses signingscript instead of iscript
201-
if "macosx" in build_platform and config.kind.endswith("-mac-notarization"):
200+
# Mac notarization uses signingscript instead of iscript
201+
if "macosx" in build_platform and config.kind.endswith("-notarization"):
202202
task["worker"]["signing-type"] = "release-apple-notarization"
203203
task["scopes"] = [
204204
add_scope_prefix(config, "signing:cert:release-apple-notarization")

‎taskcluster/gecko_taskgraph/transforms/task.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,7 @@ class IscriptSchema(Schema, forbid_unknown_fields=False, kw_only=True):
938938
"apple_notarization",
939939
"apple_notarization_stacked",
940940
"mac_sign_and_pkg",
941+
"mac_sign_pkg",
941942
"mac_sign_and_pkg_hardened",
942943
"mac_geckodriver",
943944
"mac_notarize_geckodriver",

‎taskcluster/gecko_taskgraph/util/dependencies.py‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,18 @@ def chunk_locale_grouping(config, tasks):
115115
product = task.attributes.get(
116116
"shipping_product", task.task.get("shipping-product")
117117
)
118-
chunk_locales = tuple(sorted(task.attributes.get("chunk_locales", [])))
119-
120-
chunk_locale_key = (platform, build_type, product, chunk_locales)
118+
chunk_locales = task.attributes.get("chunk_locales", [])
119+
if chunk_locales:
120+
chunk_key = tuple(sorted(chunk_locales))
121+
else:
122+
# Some tasks (e.g. repackage-l10n) are per-locale but still carry
123+
# the original l10n_chunk number from their chunked upstream. Use
124+
# that (a string, e.g. "1") to re-group them back into their
125+
# original chunks. The type differs from the tuple above, but
126+
# that's fine for dict-key grouping since they never collide.
127+
chunk_key = task.attributes.get("l10n_chunk", ())
128+
129+
chunk_locale_key = (platform, build_type, product, chunk_key)
121130
groups.setdefault(chunk_locale_key, [])
122131
if task not in groups[chunk_locale_key]:
123132
groups[chunk_locale_key].append(task)

0 commit comments

Comments
 (0)