upload_generated_sources.py (1817B)
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 upload-generated-files task description template, 6 taskcluster/kinds/upload-generated-sources/kind.yml, into an actual task description. 7 """ 8 9 from taskgraph.transforms.base import TransformSequence 10 from taskgraph.util.dependencies import get_primary_dependency 11 12 transforms = TransformSequence() 13 14 15 @transforms.add 16 def add_task_info(config, jobs): 17 for job in jobs: 18 dep_task = get_primary_dependency(config, job) 19 assert dep_task 20 21 # Add a dependency on the build task. 22 job["dependencies"] = {"build": dep_task.label} 23 # Label the job to match the build task it's uploading from. 24 job["label"] = dep_task.label.replace("build-", "upload-generated-sources-") 25 # Copy over some bits of metdata from the build task. 26 dep_th = dep_task.task["extra"]["treeherder"] 27 job.setdefault("attributes", {}) 28 job["attributes"]["build_platform"] = dep_task.attributes.get("build_platform") 29 if dep_task.attributes.get("shippable"): 30 job["attributes"]["shippable"] = True 31 plat = "{}/{}".format( 32 dep_th["machine"]["platform"], dep_task.attributes.get("build_type") 33 ) 34 job["treeherder"]["platform"] = plat 35 job["treeherder"]["tier"] = dep_th["tier"] 36 if dep_th["symbol"] != "N": 37 job["treeherder"]["symbol"] = "Ugs{}".format(dep_th["symbol"]) 38 job["run-on-projects"] = dep_task.attributes.get("run_on_projects") 39 job["optimization"] = dep_task.optimization 40 job["shipping-product"] = dep_task.attributes.get("shipping_product") 41 42 yield job