beetmover_rpm.py (2450B)
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 from collections import defaultdict 5 6 from taskgraph.transforms.base import TransformSequence 7 from taskgraph.util.dependencies import get_primary_dependency 8 9 from gecko_taskgraph.util.scriptworker import ( 10 generate_artifact_registry_gcs_sources_rpm, 11 get_beetmover_repo_action_scope, 12 get_beetmover_yum_repo_scope, 13 ) 14 15 transforms = TransformSequence() 16 17 18 @transforms.add 19 def beetmover_rpm(config, tasks): 20 products_tasks = defaultdict(lambda: []) 21 22 for task in tasks: 23 dep = get_primary_dependency(config, task) 24 assert dep 25 26 product = dep.attributes.get("shipping_product") 27 products_tasks[product].append(task) 28 29 for product, product_tasks in products_tasks.items(): 30 dependencies = {} 31 gcs_sources = [] 32 33 for task in product_tasks: 34 dep = get_primary_dependency(config, task) 35 assert dep 36 37 dependencies[dep.label] = dep.label 38 gcs_sources.extend(generate_artifact_registry_gcs_sources_rpm(dep)) 39 40 description = f"Beetmover YUM submission for the {config.params['release_type']} {product} .rpm packages" 41 platform = f"{product}-release/opt" 42 43 treeherder = { 44 "platform": platform, 45 "tier": 1, 46 "kind": "other", 47 "symbol": "BM-rpm", 48 } 49 50 yum_repo_scope = get_beetmover_yum_repo_scope(config) 51 repo_action_scope = get_beetmover_repo_action_scope(config) 52 53 attributes = { 54 "required_signoffs": ["mar-signing"], 55 "shippable": True, 56 "shipping_product": product, 57 } 58 59 worker = { 60 "implementation": "beetmover-import-from-gcs-to-artifact-registry", 61 "product": product, 62 "gcs-sources": gcs_sources, 63 } 64 65 task = { 66 "label": f"{config.kind}-{platform}", 67 "description": description, 68 "worker-type": "beetmover", 69 "treeherder": treeherder, 70 "scopes": [yum_repo_scope, repo_action_scope], 71 "attributes": attributes, 72 "shipping-phase": "ship", 73 "shipping-product": product, 74 "dependencies": dependencies, 75 "worker": worker, 76 } 77 78 yield task