source_checksums_signing.py (3367B)
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 Transform the checksums signing task into an actual task description. 6 """ 7 8 from taskgraph.transforms.base import TransformSequence 9 from taskgraph.util.dependencies import get_primary_dependency 10 from taskgraph.util.schema import Schema 11 from voluptuous import Optional 12 13 from gecko_taskgraph.transforms.task import task_description_schema 14 from gecko_taskgraph.util.attributes import copy_attributes_from_dependent_job 15 from gecko_taskgraph.util.scriptworker import get_signing_type 16 17 checksums_signing_description_schema = Schema({ 18 Optional("label"): str, 19 Optional("treeherder"): task_description_schema["treeherder"], 20 Optional("shipping-product"): task_description_schema["shipping-product"], 21 Optional("shipping-phase"): task_description_schema["shipping-phase"], 22 Optional("task-from"): task_description_schema["task-from"], 23 Optional("attributes"): task_description_schema["attributes"], 24 Optional("dependencies"): task_description_schema["dependencies"], 25 Optional("run-on-repo-type"): task_description_schema["run-on-repo-type"], 26 }) 27 28 transforms = TransformSequence() 29 30 31 @transforms.add 32 def remove_name(config, jobs): 33 for job in jobs: 34 if "name" in job: 35 del job["name"] 36 yield job 37 38 39 transforms.add_validate(checksums_signing_description_schema) 40 41 42 @transforms.add 43 def make_checksums_signing_description(config, jobs): 44 for job in jobs: 45 dep_job = get_primary_dependency(config, job) 46 assert dep_job 47 48 attributes = dep_job.attributes 49 50 treeherder = job.get("treeherder", {}) 51 treeherder.setdefault("symbol", "css(N)") 52 dep_th_platform = ( 53 dep_job.task.get("extra", {}) 54 .get("treeherder", {}) 55 .get("machine", {}) 56 .get("platform", "") 57 ) 58 treeherder.setdefault("platform", f"{dep_th_platform}/opt") 59 treeherder.setdefault("tier", 1) 60 treeherder.setdefault("kind", "build") 61 62 label = job["label"] 63 description = "Signing of release-source checksums file" 64 dependencies = {"beetmover": dep_job.label} 65 66 attributes = copy_attributes_from_dependent_job(dep_job) 67 68 upstream_artifacts = [ 69 { 70 "taskId": {"task-reference": "<beetmover>"}, 71 "taskType": "beetmover", 72 "paths": [ 73 "public/target-source.checksums", 74 ], 75 "formats": ["gcp_prod_autograph_gpg"], 76 } 77 ] 78 79 signing_type = get_signing_type(config) 80 81 task = { 82 "label": label, 83 "description": description, 84 "worker-type": "linux-signing", 85 "worker": { 86 "implementation": "scriptworker-signing", 87 "signing-type": signing_type, 88 "upstream-artifacts": upstream_artifacts, 89 }, 90 "dependencies": dependencies, 91 "attributes": attributes, 92 "run-on-projects": dep_job.attributes.get("run_on_projects"), 93 "run-on-repo-type": job.get("run-on-repo-type", ["git", "hg"]), 94 "treeherder": treeherder, 95 } 96 97 yield task