release_generate_checksums_signing.py (3589B)
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 release-generate-checksums-signing task into 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 taskgraph.util.taskcluster import get_artifact_path 12 from voluptuous import Optional 13 14 from gecko_taskgraph.transforms.task import task_description_schema 15 from gecko_taskgraph.util.attributes import copy_attributes_from_dependent_job 16 from gecko_taskgraph.util.scriptworker import get_signing_type 17 18 release_generate_checksums_signing_schema = Schema({ 19 Optional("label"): str, 20 Optional("dependencies"): task_description_schema["dependencies"], 21 Optional("attributes"): task_description_schema["attributes"], 22 Optional("treeherder"): task_description_schema["treeherder"], 23 Optional("shipping-product"): task_description_schema["shipping-product"], 24 Optional("shipping-phase"): task_description_schema["shipping-phase"], 25 Optional("task-from"): task_description_schema["task-from"], 26 Optional("run-on-repo-type"): task_description_schema["run-on-repo-type"], 27 }) 28 29 transforms = TransformSequence() 30 31 32 @transforms.add 33 def remote_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(release_generate_checksums_signing_schema) 41 42 43 @transforms.add 44 def make_release_generate_checksums_signing_description(config, jobs): 45 for job in jobs: 46 dep_job = get_primary_dependency(config, job) 47 assert dep_job 48 49 attributes = copy_attributes_from_dependent_job(dep_job) 50 51 treeherder = job.get("treeherder", {}) 52 treeherder.setdefault("symbol", "SGenChcks") 53 dep_th_platform = ( 54 dep_job.task.get("extra", {}) 55 .get("treeherder", {}) 56 .get("machine", {}) 57 .get("platform", "") 58 ) 59 treeherder.setdefault("platform", f"{dep_th_platform}/opt") 60 treeherder.setdefault("tier", 1) 61 treeherder.setdefault("kind", "build") 62 63 job_template = "{}-{}".format(dep_job.label, "signing") 64 label = job.get("label", job_template) 65 description = "Signing of the overall release-related checksums" 66 67 dependencies = {dep_job.kind: dep_job.label} 68 69 upstream_artifacts = [ 70 { 71 "taskId": {"task-reference": f"<{str(dep_job.kind)}>"}, 72 "taskType": "build", 73 "paths": [ 74 get_artifact_path(dep_job, "SHA256SUMS"), 75 get_artifact_path(dep_job, "SHA512SUMS"), 76 ], 77 "formats": ["gcp_prod_autograph_gpg"], 78 } 79 ] 80 81 signing_type = get_signing_type(config) 82 83 task = { 84 "label": label, 85 "description": description, 86 "worker-type": "linux-signing", 87 "worker": { 88 "implementation": "scriptworker-signing", 89 "signing-type": signing_type, 90 "upstream-artifacts": upstream_artifacts, 91 }, 92 "dependencies": dependencies, 93 "attributes": attributes, 94 "run-on-projects": dep_job.attributes.get("run_on_projects"), 95 "run-on-repo-type": job.get("run-on-repo-type", ["git", "hg"]), 96 "treeherder": treeherder, 97 } 98 99 yield task