summaryrefslogtreecommitdiffstats
path: root/comm/taskcluster/comm_taskgraph/transforms/l10n_source_signing.py
blob: 92a95cb612d255d1e02370412e62b7454c12ed4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 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 signing task into an actual task description.
"""

from taskgraph.transforms.base import TransformSequence
from taskgraph.util.taskcluster import get_artifact_path

from gecko_taskgraph.transforms.build_signing import add_signed_routes
from gecko_taskgraph.util.attributes import copy_attributes_from_dependent_job

transforms = TransformSequence()

transforms.add(add_signed_routes)


@transforms.add
def define_upstream_artifacts(config, jobs):
    for job in jobs:
        dep_job = job["primary-dependency"]
        upstream_artifact_task = job.pop("upstream-artifact-task", dep_job)

        job["attributes"] = copy_attributes_from_dependent_job(dep_job)

        artifacts_specifications = [
            {
                "artifacts": [
                    get_artifact_path(job, "strings_all.tar.zst"),
                    get_artifact_path(job, "l10n-changesets.json"),
                ],
                "formats": ["autograph_gpg"],
            }
        ]

        task_ref = f"<{upstream_artifact_task.kind}>"
        task_type = "build"
        if "notarization" in upstream_artifact_task.kind:
            task_type = "scriptworker"

        job["upstream-artifacts"] = [
            {
                "taskId": {"task-reference": task_ref},
                "taskType": task_type,
                "paths": spec["artifacts"],
                "formats": spec["formats"],
            }
            for spec in artifacts_specifications
        ]

        yield job