summaryrefslogtreecommitdiffstats
path: root/taskcluster/taskgraph/transforms/mac_notarization_poller.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /taskcluster/taskgraph/transforms/mac_notarization_poller.py
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'taskcluster/taskgraph/transforms/mac_notarization_poller.py')
-rw-r--r--taskcluster/taskgraph/transforms/mac_notarization_poller.py100
1 files changed, 100 insertions, 0 deletions
diff --git a/taskcluster/taskgraph/transforms/mac_notarization_poller.py b/taskcluster/taskgraph/transforms/mac_notarization_poller.py
new file mode 100644
index 0000000000..1f9887d6bf
--- /dev/null
+++ b/taskcluster/taskgraph/transforms/mac_notarization_poller.py
@@ -0,0 +1,100 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+"""
+Transform the mac notarization poller task into an actual task description.
+"""
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+from taskgraph.transforms.base import TransformSequence
+from taskgraph.util.attributes import copy_attributes_from_dependent_job
+from taskgraph.util.taskcluster import get_artifact_url
+from taskgraph.util.treeherder import add_suffix, join_symbol
+
+
+transforms = TransformSequence()
+
+
+@transforms.add
+def make_task_description(config, jobs):
+ for job in jobs:
+ dep_job = job["primary-dependency"]
+ attributes = dep_job.attributes
+
+ build_platform = dep_job.attributes.get("build_platform")
+ treeherder = None
+ if "partner" not in config.kind and "eme-free" not in config.kind:
+ treeherder = job.get("treeherder", {})
+
+ dep_th_platform = (
+ dep_job.task.get("extra", {})
+ .get("treeherder", {})
+ .get("machine", {})
+ .get("platform", "")
+ )
+ build_type = dep_job.attributes.get("build_type")
+ treeherder.setdefault(
+ "platform", "{}/{}".format(dep_th_platform, build_type)
+ )
+
+ dep_treeherder = dep_job.task.get("extra", {}).get("treeherder", {})
+ treeherder.setdefault("tier", dep_treeherder.get("tier", 1))
+ treeherder.setdefault(
+ "symbol",
+ _generate_treeherder_symbol(
+ dep_treeherder.get("groupSymbol", "?"), dep_treeherder.get("symbol")
+ ),
+ )
+ treeherder.setdefault("kind", "build")
+
+ label = dep_job.label.replace("part-1", "poller")
+ description = (
+ "Mac Notarization Poller for build '"
+ "{build_platform}/{build_type}'".format(
+ build_platform=build_platform, build_type=attributes.get("build_type")
+ )
+ )
+
+ attributes = (
+ job["attributes"]
+ if job.get("attributes")
+ else copy_attributes_from_dependent_job(dep_job)
+ )
+ attributes["signed"] = True
+
+ if dep_job.attributes.get("chunk_locales"):
+ # Used for l10n attribute passthrough
+ attributes["chunk_locales"] = dep_job.attributes.get("chunk_locales")
+
+ uuid_manifest_url = get_artifact_url("<part1>", "public/uuid_manifest.json")
+ task = {
+ "label": label,
+ "description": description,
+ "worker": {
+ "implementation": "notarization-poller",
+ "uuid-manifest": {"task-reference": uuid_manifest_url},
+ },
+ "worker-type": "mac-notarization-poller",
+ "dependencies": {"part1": dep_job.label},
+ "attributes": attributes,
+ "run-on-projects": dep_job.attributes.get("run_on_projects"),
+ "optimization": dep_job.optimization,
+ "routes": job.get("routes", []),
+ "shipping-product": job.get("shipping-product"),
+ "shipping-phase": job.get("shipping-phase"),
+ }
+
+ if treeherder:
+ task["treeherder"] = treeherder
+ if job.get("extra"):
+ task["extra"] = job["extra"]
+ # we may have reduced the priority for partner jobs, otherwise task.py will set it
+ if job.get("priority"):
+ task["priority"] = job["priority"]
+
+ yield task
+
+
+def _generate_treeherder_symbol(group_symbol, build_symbol):
+ return join_symbol(group_symbol, add_suffix(build_symbol, "-poll"))