build_attrs.py (1090B)
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 from taskgraph.transforms.base import TransformSequence 6 7 transforms = TransformSequence() 8 9 10 @transforms.add 11 def set_build_attributes(config, jobs): 12 """ 13 Set the build_platform and build_type attributes based on the job name. 14 Although not all jobs using this transform are actual "builds", the try 15 option syntax treats them as such, and this arranges the attributes 16 appropriately for that purpose. 17 """ 18 for job in jobs: 19 build_platform, build_type = job["name"].split("/") 20 21 # pgo builds are represented as a different platform, type opt 22 if build_type == "pgo": 23 build_platform = build_platform + "-pgo" 24 build_type = "opt" 25 26 attributes = job.setdefault("attributes", {}) 27 attributes.update({ 28 "build_platform": build_platform, 29 "build_type": build_type, 30 }) 31 32 yield job