From 0961edc4407935afa579e7b135cc90bd3d9a32c6 Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Wed, 20 Nov 2024 13:48:57 -0500 Subject: [PATCH] feat: add generic-worker metadata to pool configurations --- src/ciadmin/generate/worker_pools.py | 12 +++++++++--- tests/ciadmin/test_generate_worker_pools.py | 5 +++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/ciadmin/generate/worker_pools.py b/src/ciadmin/generate/worker_pools.py index 248266e9..aeea5314 100644 --- a/src/ciadmin/generate/worker_pools.py +++ b/src/ciadmin/generate/worker_pools.py @@ -195,10 +195,16 @@ def get_azure_provider_config( {"implementation": implementation}, ) worker_config = merge(worker_config, config.get("worker-config", {})) + gw_config = worker_config["genericWorker"]["config"] if azure_config.get("wst_server_url"): - worker_config["genericWorker"]["config"].setdefault( - "wstServerURL", azure_config["wst_server_url"] - ) + gw_config.setdefault("wstServerURL", azure_config["wst_server_url"]) + + try: + metadata = image.image_id(provider_id, "generic_worker_metadata") + gw_config.setdefault("workerTypeMetaData", metadata) + except KeyError: + pass + tags = config.get("tags", {}) launch_configs = [] diff --git a/tests/ciadmin/test_generate_worker_pools.py b/tests/ciadmin/test_generate_worker_pools.py index 1cfcd762..8b19aab9 100644 --- a/tests/ciadmin/test_generate_worker_pools.py +++ b/tests/ciadmin/test_generate_worker_pools.py @@ -73,6 +73,7 @@ def inner(provider, extra_config=None): "locations": ["us-east1"], "image_resource_group": "rg", "vmSizes": [{"vmSize": "Standard_F8s_v2"}], + "worker-config": {"genericWorker": {"config": {}}}, "worker-purpose": "test", } ) @@ -186,7 +187,7 @@ def assert_azure_basic(pool): }, "subnetId": "/subscriptions/subscription_id/resourceGroups/rg-us-east1-test/providers/Microsoft.Network/virtualNetworks/vn-us-east1-test/subnets/sn-us-east1-test", # noqa: E501 "tags": {"deploymentId": "d_id"}, - "workerConfig": {}, + "workerConfig": {"genericWorker": {"config": {}}}, } @@ -208,7 +209,7 @@ def assert_azure_version(pool): }, "subnetId": "/subscriptions/subscription_id/resourceGroups/rg-us-east1-test/providers/Microsoft.Network/virtualNetworks/vn-us-east1-test/subnets/sn-us-east1-test", # noqa: E501 "tags": {"deploymentId": "d_id"}, - "workerConfig": {}, + "workerConfig": {"genericWorker": {"config": {}}}, }