Bug 1547111: Allow varying the worker-pool provider in variants; r=aki
authorTom Prince <mozilla@hocat.ca>
Tue, 26 May 2020 16:29:13 +0000
changeset 232 f0753622410594905371d557d85af3c8ac1c672e
parent 231 d58dab2cc7d7c0d35a5ec524e188fc09dbf05ec1
child 233 4a787c62d44e36e901fb463b8686bdb3ea1d5ce0
push id167
push usermozilla@hocat.ca
push dateTue, 26 May 2020 18:00:06 +0000
treeherderci-admin@f07536224105 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaki
bugs1547111
Bug 1547111: Allow varying the worker-pool provider in variants; r=aki In GCP, we have different GCP projects (represented by different worker manager providers) for level-1, level-3 and test workers. Thus we need to be able to vary the provider in variant worker-pool families. Differential Revision: https://phabricator.services.mozilla.com/D76775
src/ciadmin/generate/worker_pools.py
--- a/src/ciadmin/generate/worker_pools.py
+++ b/src/ciadmin/generate/worker_pools.py
@@ -222,38 +222,38 @@ async def make_worker_pool(environment, 
 
 
 def generate_pool_variants(worker_pools, environment):
     """
     Generate the list of worker pools by evaluting them at all the specified
     variants.
     """
 
-    def update_config(config, name, variant, environment):
+    def update_config(config, name, attributes):
         config = copy.deepcopy(config)
-        attributes = {"environment": environment}
-        attributes.update(variant)
         for key in ["image", "maxCapacity", "minCapacity", "security"]:
             if key in config:
                 value = evaluate_keyed_by(config[key], name, attributes)
                 if value is not None:
                     config[key] = value
                 else:
                     del config[key]
         return config
 
     for wp in worker_pools:
         for variant in wp.variants:
             name = wp.pool_id.format(**variant)
+            attributes = {"environment": environment}
+            attributes.update(variant)
+
             yield attr.evolve(
                 wp,
                 pool_id=name,
-                config=update_config(
-                    wp.config, name, variant, environment=environment.name
-                ),
+                provider_id=evaluate_keyed_by(wp.provider_id, name, attributes),
+                config=update_config(wp.config, name, attributes),
                 variants=[{}],
             )
 
 
 async def update_resources(resources):
     """
     Manage the worker-pool configurations
     """