Skip to content

Commit 6471079

Browse files
author
Alexandre Lissy
committed
FxCI: Fix dmg+pkg+msi enterprise repacks signature/notarization
1 parent 9f5d886 commit 6471079

File tree

10 files changed

+174
-24
lines changed

10 files changed

+174
-24
lines changed

python/mozbuild/mozbuild/repackaging/utils.py

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
33
# You can obtain one at http://mozilla.org/MPL/2.0/.
44

5+
import configparser
56
import json
67
import os
78
import pathlib
@@ -165,14 +166,44 @@ def inject_desktop_entry_file(
165166

166167
def inject_distribution_folder(source_dir, source_type, app_name):
167168
distribution_ini_path = mozpath.join(source_dir, source_type, "distribution.ini")
169+
distribution_ini_dir = mozpath.join(source_dir, app_name.lower(), "distribution")
170+
distribution_ini_target = mozpath.join(distribution_ini_dir, "distribution.ini")
168171

169172
os.makedirs(
170173
mozpath.join(source_dir, app_name.lower(), "distribution"), exist_ok=True
171174
)
172-
shutil.move(
173-
distribution_ini_path,
174-
mozpath.join(source_dir, app_name.lower(), "distribution"),
175-
)
175+
176+
if not os.path.exists(distribution_ini_target):
177+
shutil.move(
178+
distribution_ini_path,
179+
distribution_ini_dir,
180+
)
181+
else:
182+
print(f"{distribution_ini_target} exists, merging")
183+
existing_ini = configparser.ConfigParser()
184+
existing_ini.read(distribution_ini_target)
185+
186+
debian_ini = configparser.ConfigParser()
187+
debian_ini.read(distribution_ini_path)
188+
189+
for section in debian_ini.sections():
190+
if "global" in section.lower():
191+
continue
192+
193+
if "preferences" in section.lower():
194+
if not section in existing_ini.sections():
195+
print(f"{distribution_ini_target} misses {section}")
196+
existing_ini[section] = {}
197+
198+
for pref in debian_ini[section]:
199+
if pref in existing_ini[section]:
200+
print(f"{distribution_ini_target} defines {pref}, skipping")
201+
else:
202+
print(f"{distribution_ini_target} adding {pref}")
203+
existing_ini[section][pref] = debian_ini[section][pref]
204+
205+
with open(distribution_ini_target, "w") as distribution_ini_modified:
206+
existing_ini.write(distribution_ini_modified, space_around_delimiters=False)
176207

177208

178209
def inject_prefs_file(source_dir, app_name, template_dir):

taskcluster/docs/kinds.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,3 +978,11 @@ Generates customized versions of releases for enterprises.
978978
enterprise-repack-repackage
979979
---------------------------
980980
Repackage customized versions of releases for enterprises.
981+
982+
enterprise-repack-mac-notarization
983+
----------------------------------
984+
Mac notarization of customized versions of releases for enterprises.
985+
986+
enterprise-repack-mac-signing
987+
----------------------------------
988+
Mac signature of customized versions of releases for enterprises.

taskcluster/gecko_taskgraph/decision.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,21 @@
119119
"target_tasks_method": "enterprise_firefox_with_tests_tasks",
120120
"release_type": "nightly-enterprise",
121121
"release_product": "firefox-enterprise",
122+
"release_partners": ["sample"],
123+
"release_partner_config": {
124+
"enterprise-repack-repackage": {
125+
"sample": {
126+
"gcpEU": {
127+
"locales": ["en-US"],
128+
"platforms": [
129+
"linux64-enterprise-shippable",
130+
"macosx64-enterprise-shippable",
131+
"win64-enterprise-shippable",
132+
],
133+
},
134+
},
135+
},
136+
},
122137
},
123138
# the default parameters are used for projects that do not match above.
124139
"default": {

taskcluster/gecko_taskgraph/transforms/chunk_partners.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def chunk_partners(config, jobs):
4545
"release-eme-free-repack-signing",
4646
"release-eme-free-repack-mac-signing",
4747
"release-partner-repack-mac-signing",
48+
"enterprise-repack-signing",
49+
"enterprise-repack-mac-signing",
4850
):
4951
repacks_per_chunk = job.get("repacks-per-chunk")
5052
chunks, remainder = divmod(len(platform_repack_ids), repacks_per_chunk)

taskcluster/gecko_taskgraph/transforms/repackage.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ def handle_keyed_by(config, jobs):
416416
"worker.max-run-time",
417417
"flatpak.name",
418418
"flatpak.branch",
419+
"treeherder",
419420
]
420421
for job in jobs:
421422
job = deepcopy(job) # don't overwrite dict values here
@@ -487,14 +488,30 @@ def make_job_description(config, jobs):
487488
if "repack" in dep_job.label:
488489
variant = f"{variant}-ent"
489490

491+
repack_id = dep_job.task.get("extra").get("repack_id")
492+
if repack_id:
493+
variant = f"-{repack_id}"
494+
490495
treeherder["symbol"] = f"Rpk({platform_simple}{variant})"
491496

492-
if "enterprise-repack" in dep_job.label:
497+
if "enterprise-repack" in dep_job.kind:
493498
job["label"] = job["label"].replace(
494499
"repackage", "repackage-enterprise-repack"
495500
)
496501

497502
dep_th_platform = dep_job.task.get("extra", {}).get("treeherder-platform")
503+
# TODO: Hack because we loose the platform that was from enterprise-repack
504+
if not dep_th_platform and "enterprise-repack-repackage" in dep_job.kind:
505+
build_platform = attributes.get("build_platform")
506+
if "linux64" in build_platform:
507+
dep_th_platform = "linux64/opt"
508+
elif "macosx64" in build_platform:
509+
dep_th_platform = "osx-cross/opt"
510+
elif "win64" in build_platform:
511+
dep_th_platform = "windows2012-64/opt"
512+
else:
513+
raise ValueError(f"Unsupported {build_platform}")
514+
498515
treeherder.setdefault("platform", dep_th_platform)
499516
treeherder.setdefault("tier", 1)
500517
treeherder.setdefault("kind", "build")
@@ -505,6 +522,8 @@ def make_job_description(config, jobs):
505522
for dependency in dependencies.keys():
506523
if "repackage-signing" in dependency:
507524
repackage_signing_task = dependency
525+
elif "enterprise-repack-repackage" in dependency:
526+
repackage_signing_task = dependency
508527
elif "signing" in dependency or "notarization" in dependency:
509528
signing_task = dependency
510529
elif "shippable-l10n" in dependency:
@@ -811,6 +830,8 @@ def _generate_download_config(
811830

812831
if "enterprise-repack" in task.label:
813832
enterprise_repacks = task.attributes.get("enterprise_repacks", [])
833+
if not enterprise_repacks:
834+
enterprise_repacks = [task.task.get("extra").get("repack_id")]
814835
# TODO: Only one repack, gcpEU for now
815836
locale_path = f"{enterprise_repacks[0]}/"
816837

taskcluster/gecko_taskgraph/transforms/repackage_partner.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,19 @@ def make_job_description(config, jobs):
206206
)
207207
)
208208

209+
scopes = (
210+
[]
211+
if "enterprise-repack" in job["label"]
212+
else ["queue:get-artifact:releng/partner/*"]
213+
)
214+
209215
task = {
210216
"label": job["label"],
211217
"description": description,
212218
"worker-type": worker_type,
213219
"dependencies": dependencies,
214220
"attributes": attributes,
215-
"scopes": ["queue:get-artifact:releng/partner/*"],
221+
"scopes": scopes,
216222
"run-on-projects": dep_job.attributes.get("run_on_projects"),
217223
"routes": job.get("routes", []),
218224
"extra": job.get("extra", {}),
@@ -228,6 +234,32 @@ def make_job_description(config, jobs):
228234
),
229235
}
230236

237+
if "enterprise-repack-repackage" in job["label"]:
238+
# TODO:
239+
# Exception: repackage-enterprise-repack-msi-win64-enterprise-shippable/opt (tier 1) cannot depend on enterprise-repack-repackage-win64-enterprise-shippable/opt (tier unknown)
240+
platform = (
241+
attributes.get("build_platform")
242+
.replace("enterprise-", "")
243+
.replace("shippable", "")
244+
)
245+
if "linux64" in platform:
246+
th_platform = "linux64/opt"
247+
elif "macosx64" in platform:
248+
th_platform = "osx-cross/opt"
249+
elif "win64" in platform:
250+
th_platform = "windows2012-64/opt"
251+
else:
252+
raise ValueError(f"Unsupported {platform}")
253+
254+
repack_id = task["extra"]["repack_id"]
255+
task["extra"]["treeherder"] = {
256+
"platform": th_platform,
257+
"tier": 1,
258+
"kind": "build",
259+
"collection": {"opt": True},
260+
"symbol": f"Ent-Rpk({platform}-{repack_id})",
261+
}
262+
231263
# we may have reduced the priority for partner jobs, otherwise task.py will set it
232264
if job.get("priority"):
233265
task["priority"] = job["priority"]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
loader: taskgraph.loader.transform:loader
6+
7+
transforms:
8+
- taskgraph.transforms.from_deps
9+
- gecko_taskgraph.transforms.mac_notarization
10+
- gecko_taskgraph.transforms.chunk_partners
11+
- gecko_taskgraph.transforms.partner_signing
12+
- gecko_taskgraph.transforms.signing
13+
- gecko_taskgraph.transforms.task
14+
15+
kind-dependencies:
16+
- enterprise-repack-mac-signing
17+
18+
only-for-build-platforms:
19+
- macosx64-shippable/opt
20+
- macosx64-enterprise-shippable/opt
21+
22+
tasks:
23+
enterprise-repack-mac-notarization:
24+
from-deps:
25+
group-by: partner-repack-ids
26+
copy-attributes: true
27+
shipping-product: firefox
28+
# TODO: shipping-phase: promote
29+
copy-repack-ids: true
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
loader: taskgraph.loader.transform:loader
6+
7+
transforms:
8+
- taskgraph.transforms.from_deps
9+
- gecko_taskgraph.transforms.chunk_partners
10+
- gecko_taskgraph.transforms.name_sanity
11+
- gecko_taskgraph.transforms.partner_signing
12+
- gecko_taskgraph.transforms.signing
13+
- gecko_taskgraph.transforms.hardened_signing
14+
- gecko_taskgraph.transforms.task
15+
16+
kind-dependencies:
17+
- enterprise-repack
18+
19+
only-for-build-platforms:
20+
- macosx64-enterprise-shippable/opt
21+
22+
tasks:
23+
enterprise-repack-mac-signing:
24+
from-deps:
25+
group-by: partner-repack-ids
26+
shipping-product: firefox
27+
# TODO: shipping-phase: promote
28+
repacks-per-chunk: 5

taskcluster/kinds/enterprise-repack-repackage/kind.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,13 @@ transforms:
1313
- gecko_taskgraph.transforms.job
1414
- gecko_taskgraph.transforms.task
1515

16-
# Mac signing/notarization being listed here and not executed will mask
17-
# this task
1816
kind-dependencies:
1917
- enterprise-repack
2018
- toolchain
2119
- enterprise-repack-mac-signing
2220
- enterprise-repack-mac-notarization
2321

24-
task-defaults:
25-
run-on-repo-type: [git]
26-
run-on-projects: ["enterprise-firefox"]
27-
2822
only-for-build-platforms:
29-
- linux64-enterprise-shippable/opt
3023
- macosx64-enterprise-shippable/opt
3124
- win64-enterprise-shippable/opt
3225

@@ -47,23 +40,14 @@ tasks:
4740
macosx64-.*:
4841
- repackage/base.py
4942
- repackage/osx_partner.py
50-
win32-.*:
51-
- repackage/base.py
52-
- repackage/win32_sfx_stub.py
53-
- repackage/win32_partner.py
5443
win64-(?!aarch64).*:
5544
- repackage/base.py
5645
- repackage/win32_sfx_stub.py
5746
- repackage/win64_partner.py
58-
win64-aarch64-.*:
59-
- repackage/base.py
60-
- repackage/win64-aarch64_sfx_stub.py
61-
- repackage/win64_partner.py
6247
linux64.*:
6348
- repackage/base.py
6449
package-formats:
6550
by-build-platform:
66-
macosx64\b.*: [dmg]
51+
macosx64\b.*: [dmg, pkg]
6752
win32\b.*: [installer]
6853
win64\b.*: [installer]
69-
linux64\b.*: [tar]

taskcluster/kinds/repackage-msi/kind.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ transforms:
1414
kind-dependencies:
1515
- repackage-signing
1616
- repackage-signing-l10n
17-
- enterprise-repack
17+
- enterprise-repack-repackage
1818
- fetch
1919

2020
only-for-build-platforms:

0 commit comments

Comments
 (0)