From 0c7881fdb656bcb0cf2b59b7c4870b44285e4730 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Mon, 27 Oct 2025 19:15:56 +0000 Subject: [PATCH 01/39] Enhance address space handling to accept numeric CIDR masks and update documentation accordingly --- CHANGELOG.md | 1 + api_app/db/repositories/workspaces.py | 16 ++++++++++++++-- api_app/models/schemas/workspace_template.py | 2 +- .../authoring-workspace-templates.md | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 111b4513b3..088975aa69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ ENHANCEMENTS: * Update oauth2-proxy and Tomcat versions to latest in Guacamole container ([#4688](https://github.com/microsoft/AzureTRE/pull/4688)) * Standardize database query parameter handling across repository classes ([#4697](https://github.com/microsoft/AzureTRE/issues/4697)) * Improve documentation on `address_space` allocation ([#4726](https://github.com/microsoft/AzureTRE/pull/4726)) +* Allow numeric CIDR masks in `address_space_size` (e.g. "25") when requesting auto-assigned address spaces; accepts numeric strings and validates the mask range. ([#4733](https://github.com/microsoft/AzureTRE/issues/4733)) BUG FIXES: * Remove deprecated ms-teams-notification action from E2E test workflows ([#4716](https://github.com/microsoft/AzureTRE/issues/4716)) diff --git a/api_app/db/repositories/workspaces.py b/api_app/db/repositories/workspaces.py index 5be9cab979..36f366f2fb 100644 --- a/api_app/db/repositories/workspaces.py +++ b/api_app/db/repositories/workspaces.py @@ -142,13 +142,25 @@ async def get_address_space_based_on_size(self, workspace_properties: dict): address_space_size = workspace_properties.get("address_space_size", "small").lower() # 773 allow custom sized networks to be requested - if (address_space_size == "custom"): + if address_space_size == "custom": if (await self.validate_address_space(workspace_properties.get("address_space"))): return workspace_properties.get("address_space") else: raise InvalidInput("The custom 'address_space' you requested does not fit in the current network.") - # Default mask is 24 (small) + # If a numeric cidr was provided (e.g as a string like "25"), accept it + try: + if address_space_size.isdigit(): + cidr_netmask = int(address_space_size) + # basic validation for reasonable CIDR mask values + if cidr_netmask < 16 or cidr_netmask > 29: + raise InvalidInput("'address_space_size' numeric value must be between 16 and 29") + return await self.get_new_address_space(cidr_netmask) + except ValueError: + # fall through to predefined handling + pass + + # Default mask is 24 (small). Keep backwards compatibility with presets. cidr_netmask = WorkspaceRepository.predefined_address_spaces.get(address_space_size, 24) return await self.get_new_address_space(cidr_netmask) diff --git a/api_app/models/schemas/workspace_template.py b/api_app/models/schemas/workspace_template.py index bc20955217..0b3fcd31e0 100644 --- a/api_app/models/schemas/workspace_template.py +++ b/api_app/models/schemas/workspace_template.py @@ -22,7 +22,7 @@ def get_sample_workspace_template_object(template_name: str = "tre-workspace-bas "address_space_size": Property( type="string", default="small", - description="This can have a value of small, medium, large or custom. If you specify custom, then you need to specify a VNet address space in 'address_space' (e.g. 10.2.1.0/24)") + description="This can have a value of small, medium, large, a numeric CIDR mask (e.g. 25) or custom. If you specify custom, then you need to specify a VNet address space in 'address_space' (e.g. 10.2.1.0/24)") }, customActions=[ CustomAction() diff --git a/docs/tre-workspace-authors/authoring-workspace-templates.md b/docs/tre-workspace-authors/authoring-workspace-templates.md index 23614bb29f..7fca854056 100644 --- a/docs/tre-workspace-authors/authoring-workspace-templates.md +++ b/docs/tre-workspace-authors/authoring-workspace-templates.md @@ -105,7 +105,7 @@ Some workspace services may require additional address spaces to be provisioned. To request an additional address space, the workspace service bundle must define an `address_space` parameter in the `porter.yaml` file. The value of this parameter will be provided by API to the resource processor. -The size of the `address_space` will default to `/24`, however other sizes can be requested by including an `address_space_size` as part of the workspace service template. +The size of the `address_space` will default to `/24`, however other sizes can be requested by including an `address_space_size` as part of the workspace service template. This parameter accepts the presets `small` (/24), `medium` (/22), `large` (/16), the literal value `custom` together with an explicit `address_space` CIDR (e.g. `10.2.1.0/25`), or a numeric CIDR mask as a string (e.g. `"25"`) to ask the system to auto-select an available `/25`. The `address_space` allocation will only take place during the install phase of a deployment, as this is a breaking change to your template you should increment the major version of your template, this means a you must deploy a new resource instead of upgrading an existing one. From 3511980eac60d1bc17196a8f404c757f1b706f35 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Mon, 27 Oct 2025 19:25:33 +0000 Subject: [PATCH 02/39] update version --- api_app/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_app/_version.py b/api_app/_version.py index 6fea77c010..71290cd566 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.25.0" +__version__ = "0.25.1" From 68c8df123ec090e4c99c551f0c42c95907006bbf Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 28 Oct 2025 09:01:59 +0000 Subject: [PATCH 03/39] add tests --- .../test_workpaces_repository.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py index a72b2d85e1..1eea120a12 100644 --- a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py +++ b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py @@ -330,3 +330,29 @@ async def test_is_workspace_storage_account_available_when_name_not_available(mo mock_storage_client.return_value.storage_accounts.check_name_availability.assert_called_once_with({"name": f"stgws{workspace_id[-4:]}"}) assert result is False + + +@pytest.mark.asyncio +@patch('core.config.RESOURCE_LOCATION', "useast2") +@patch('core.config.TRE_ID', "9876") +@patch('core.config.CORE_ADDRESS_SPACE', "10.1.0.0/22") +@patch('core.config.TRE_ADDRESS_SPACE', "10.0.0.0/12") +async def test_get_address_space_based_on_size_with_string_19(workspace_repo, basic_workspace_request): + workspace_to_create = basic_workspace_request + # request a /19 + workspace_to_create.properties["address_space_size"] = "19" + address_space = await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) + assert address_space.endswith('/19') + + +@pytest.mark.asyncio +@patch('core.config.RESOURCE_LOCATION', "useast2") +@patch('core.config.TRE_ID', "9876") +@patch('core.config.CORE_ADDRESS_SPACE', "10.1.0.0/22") +@patch('core.config.TRE_ADDRESS_SPACE', "10.0.0.0/12") +async def test_get_address_space_based_on_size_with_string_29(workspace_repo, basic_workspace_request): + workspace_to_create = basic_workspace_request + # request a /29 + workspace_to_create.properties["address_space_size"] = "29" + address_space = await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) + assert address_space.endswith('/29') From f0dfda65ce6ec08196294a295491e97b61e379b5 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 28 Oct 2025 09:03:41 +0000 Subject: [PATCH 04/39] docs --- docs/tre-workspace-authors/authoring-workspace-templates.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/tre-workspace-authors/authoring-workspace-templates.md b/docs/tre-workspace-authors/authoring-workspace-templates.md index 7fca854056..48e9f7a24c 100644 --- a/docs/tre-workspace-authors/authoring-workspace-templates.md +++ b/docs/tre-workspace-authors/authoring-workspace-templates.md @@ -105,7 +105,8 @@ Some workspace services may require additional address spaces to be provisioned. To request an additional address space, the workspace service bundle must define an `address_space` parameter in the `porter.yaml` file. The value of this parameter will be provided by API to the resource processor. -The size of the `address_space` will default to `/24`, however other sizes can be requested by including an `address_space_size` as part of the workspace service template. This parameter accepts the presets `small` (/24), `medium` (/22), `large` (/16), the literal value `custom` together with an explicit `address_space` CIDR (e.g. `10.2.1.0/25`), or a numeric CIDR mask as a string (e.g. `"25"`) to ask the system to auto-select an available `/25`. +The size of the `address_space` will default to `/24`, however other sizes can be requested by including an `address_space_size` as part of the workspace service template. +This parameter accepts the presets `small` (/24), `medium` (/22), `large` (/16), the literal value `custom` together with an explicit `address_space` CIDR (e.g. `10.2.1.0/25`), or a numeric CIDR mask as a string from "16" to "29" (e.g. `"25"`) to ask the system to auto-select an available `/25`. The `address_space` allocation will only take place during the install phase of a deployment, as this is a breaking change to your template you should increment the major version of your template, this means a you must deploy a new resource instead of upgrading an existing one. From 3a4e2a3af8a2a6a8a518daef3ce7606f408cdd15 Mon Sep 17 00:00:00 2001 From: JC-wk <196318169+JC-wk@users.noreply.github.com> Date: Tue, 4 Nov 2025 10:08:31 +0000 Subject: [PATCH 05/39] bump api version --- api_app/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_app/_version.py b/api_app/_version.py index 71290cd566..97b0e6226c 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.25.1" +__version__ = "0.25.2" From 8717e98858f88975b233f7f41695164f9de6941b Mon Sep 17 00:00:00 2001 From: James Chapman Date: Fri, 9 Jan 2026 10:21:43 +0000 Subject: [PATCH 06/39] bump api version --- api_app/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_app/_version.py b/api_app/_version.py index 5461be1190..4f3cae6929 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.25.7" +__version__ = "0.25.8" From 3964e9342861693328606966437a0222c00804e7 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 31 Mar 2026 15:51:58 +0000 Subject: [PATCH 07/39] update api version --- api_app/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_app/_version.py b/api_app/_version.py index 2cb28789f2..7923a95d33 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.25.15" +__version__ = "0.25.16" From 1fe1834ecc902dadead7604cc727822c5da4e602 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Fri, 22 May 2026 15:20:55 +0000 Subject: [PATCH 08/39] update version --- api_app/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_app/_version.py b/api_app/_version.py index 7923a95d33..57a322dfc2 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.25.16" +__version__ = "0.25.17" From 88ed0dd0fc793fdbe8665c13f04ad5e80d5db27f Mon Sep 17 00:00:00 2001 From: James Chapman Date: Fri, 22 May 2026 15:30:28 +0000 Subject: [PATCH 09/39] e.g. --- api_app/db/repositories/workspaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_app/db/repositories/workspaces.py b/api_app/db/repositories/workspaces.py index 72c434e0f9..2e1c4ce3fb 100644 --- a/api_app/db/repositories/workspaces.py +++ b/api_app/db/repositories/workspaces.py @@ -149,7 +149,7 @@ async def get_address_space_based_on_size(self, workspace_properties: dict): else: raise InvalidInput("The custom 'address_space' you requested does not fit in the current network.") - # If a numeric cidr was provided (e.g as a string like "25"), accept it + # If a numeric cidr was provided (e.g. as a string like "25"), accept it try: if address_space_size.isdigit(): cidr_netmask = int(address_space_size) From a72674e095cc69a42c1f0542cb7da76d251d7cbd Mon Sep 17 00:00:00 2001 From: James Chapman Date: Fri, 22 May 2026 15:32:09 +0000 Subject: [PATCH 10/39] trim whitespace --- api_app/db/repositories/workspaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_app/db/repositories/workspaces.py b/api_app/db/repositories/workspaces.py index 2e1c4ce3fb..26db14d337 100644 --- a/api_app/db/repositories/workspaces.py +++ b/api_app/db/repositories/workspaces.py @@ -140,7 +140,7 @@ def automatically_create_application_registration(self, workspace_properties: di async def get_address_space_based_on_size(self, workspace_properties: dict): # Default the address space to 'small' if not supplied. - address_space_size = workspace_properties.get("address_space_size", "small").lower() + address_space_size = workspace_properties.get("address_space_size", "small").strip().lower() # 773 allow custom sized networks to be requested if address_space_size == "custom": From a133e1571e21ee10fff111178837b97176a61c2a Mon Sep 17 00:00:00 2001 From: James Chapman Date: Fri, 22 May 2026 15:48:51 +0000 Subject: [PATCH 11/39] add tests and improve descriptions --- api_app/models/schemas/workspace_template.py | 4 ++-- .../test_repositories/test_workpaces_repository.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/api_app/models/schemas/workspace_template.py b/api_app/models/schemas/workspace_template.py index 0b3fcd31e0..9d68a3f1fd 100644 --- a/api_app/models/schemas/workspace_template.py +++ b/api_app/models/schemas/workspace_template.py @@ -22,7 +22,7 @@ def get_sample_workspace_template_object(template_name: str = "tre-workspace-bas "address_space_size": Property( type="string", default="small", - description="This can have a value of small, medium, large, a numeric CIDR mask (e.g. 25) or custom. If you specify custom, then you need to specify a VNet address space in 'address_space' (e.g. 10.2.1.0/24)") + description="This can have a value of small, medium, large, a numeric CIDR mask (e.g. \"25\") or custom. If you specify custom, then you need to specify a VNet address space in 'address_space' (e.g. 10.2.1.0/24)") }, customActions=[ CustomAction() @@ -73,7 +73,7 @@ class Config: "address_space_size": { "type": "string", "title": "Address space size", - "description": "Network address size (small, medium, large or custom) to be used by the workspace" + "description": "This can have a value of small, medium, large, a numeric CIDR mask (e.g. \"25\") or custom. If you specify custom, then you need to specify a VNet address space in 'address_space' (e.g. 10.2.1.0/24)" }, "address_space": { "type": "string", diff --git a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py index 3df91cdf3a..5e592cbea9 100644 --- a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py +++ b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py @@ -368,3 +368,16 @@ async def test_get_address_space_based_on_size_with_string_29(workspace_repo, ba workspace_to_create.properties["address_space_size"] = "29" address_space = await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) assert address_space.endswith('/29') + +@pytest.mark.asyncio +@patch('core.config.RESOURCE_LOCATION', "useast2") +@patch('core.config.TRE_ID', "9876") +@patch('core.config.CORE_ADDRESS_SPACE', "10.1.0.0/22") +@patch('core.config.TRE_ADDRESS_SPACE', "10.0.0.0/12") +@pytest.mark.parametrize("invalid_size", ["15", "30"]) +async def test_get_address_space_based_on_size_with_invalid_string_raises_error(workspace_repo, basic_workspace_request, invalid_size): + workspace_to_create = basic_workspace_request + workspace_to_create.properties["address_space_size"] = invalid_size + with pytest.raises(InvalidInput) as ex: + await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) + assert str(ex.value) == "'address_space_size' numeric value must be between 16 and 29" From 64afc1017a545aed72901bf4fdebbeff3f9c5fe5 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Fri, 22 May 2026 15:57:26 +0000 Subject: [PATCH 12/39] fix lint issue --- .../test_db/test_repositories/test_workpaces_repository.py | 1 + 1 file changed, 1 insertion(+) diff --git a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py index 5e592cbea9..474ab4f3f5 100644 --- a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py +++ b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py @@ -369,6 +369,7 @@ async def test_get_address_space_based_on_size_with_string_29(workspace_repo, ba address_space = await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) assert address_space.endswith('/29') + @pytest.mark.asyncio @patch('core.config.RESOURCE_LOCATION', "useast2") @patch('core.config.TRE_ID', "9876") From c25fc65a1d82e9fef1c083b2d6941cf30af77833 Mon Sep 17 00:00:00 2001 From: James Chapman <196318169+JC-wk@users.noreply.github.com> Date: Fri, 3 Jul 2026 17:22:40 +0100 Subject: [PATCH 13/39] Bump version to 0.25.27 --- api_app/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_app/_version.py b/api_app/_version.py index eda2a21a48..7df7ad28da 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.25.26" +__version__ = "0.25.27" From 15231a43e06ca49952e6fabe53edbf98d260676f Mon Sep 17 00:00:00 2001 From: James Chapman Date: Wed, 22 Jul 2026 08:36:24 +0000 Subject: [PATCH 14/39] PR feedback - Handle "None" (defaults to small) --- api_app/db/repositories/workspaces.py | 3 ++- .../test_repositories/test_workpaces_repository.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/api_app/db/repositories/workspaces.py b/api_app/db/repositories/workspaces.py index d206da6608..980a4fe1de 100644 --- a/api_app/db/repositories/workspaces.py +++ b/api_app/db/repositories/workspaces.py @@ -160,7 +160,8 @@ def automatically_create_application_registration(self, workspace_properties: di async def get_address_space_based_on_size(self, workspace_properties: dict): # Default the address space to 'small' if not supplied. - address_space_size = workspace_properties.get("address_space_size", "small").strip().lower() + raw_size = workspace_properties.get("address_space_size") + address_space_size = str(raw_size or "small").strip().lower() # 773 allow custom sized networks to be requested if address_space_size == "custom": diff --git a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py index d65bd557a8..c22e46065f 100644 --- a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py +++ b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py @@ -454,3 +454,14 @@ async def test_get_address_space_based_on_size_with_invalid_string_raises_error( with pytest.raises(InvalidInput) as ex: await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) assert str(ex.value) == "'address_space_size' numeric value must be between 16 and 29" + + +@pytest.mark.asyncio +@patch('core.config.RESOURCE_LOCATION', "useast2") +@patch('core.config.TRE_ID', "9876") +@patch('core.config.CORE_ADDRESS_SPACE', "10.1.0.0/22") +@patch('core.config.TRE_ADDRESS_SPACE', "10.0.0.0/12") +async def test_get_address_space_based_on_size_with_none_address_space_size(workspace_repo, basic_workspace_request): + workspace_to_create = basic_workspace_request + workspace_to_create.properties["address_space_size"] = None + assert "10.1.4.0/24" == await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) From 466fe3712f40f26d8c7dd544a623c6bdd1eed4b3 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Wed, 22 Jul 2026 08:44:33 +0000 Subject: [PATCH 15/39] None, or empty/whitespace values default to "small" (/24) --- api_app/db/repositories/workspaces.py | 13 +++++++++---- .../test_repositories/test_workpaces_repository.py | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/api_app/db/repositories/workspaces.py b/api_app/db/repositories/workspaces.py index 980a4fe1de..ff1e407ce5 100644 --- a/api_app/db/repositories/workspaces.py +++ b/api_app/db/repositories/workspaces.py @@ -161,7 +161,10 @@ def automatically_create_application_registration(self, workspace_properties: di async def get_address_space_based_on_size(self, workspace_properties: dict): # Default the address space to 'small' if not supplied. raw_size = workspace_properties.get("address_space_size") - address_space_size = str(raw_size or "small").strip().lower() + if raw_size is None or str(raw_size).strip() == "": + address_space_size = "small" + else: + address_space_size = str(raw_size).strip().lower() # 773 allow custom sized networks to be requested if address_space_size == "custom": @@ -182,9 +185,11 @@ async def get_address_space_based_on_size(self, workspace_properties: dict): # fall through to predefined handling pass - # Default mask is 24 (small). Keep backwards compatibility with presets. - cidr_netmask = WorkspaceRepository.predefined_address_spaces.get(address_space_size, 24) - return await self.get_new_address_space(cidr_netmask) + if address_space_size in WorkspaceRepository.predefined_address_spaces: + cidr_netmask = WorkspaceRepository.predefined_address_spaces[address_space_size] + return await self.get_new_address_space(cidr_netmask) + + raise InvalidInput(f"Invalid 'address_space_size': {raw_size}") # 772 check that the provided address_space is available in the network. async def validate_address_space(self, address_space): diff --git a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py index c22e46065f..9536421742 100644 --- a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py +++ b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py @@ -465,3 +465,17 @@ async def test_get_address_space_based_on_size_with_none_address_space_size(work workspace_to_create = basic_workspace_request workspace_to_create.properties["address_space_size"] = None assert "10.1.4.0/24" == await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) + + +@pytest.mark.asyncio +@patch('core.config.RESOURCE_LOCATION', "useast2") +@patch('core.config.TRE_ID', "9876") +@patch('core.config.CORE_ADDRESS_SPACE', "10.1.0.0/22") +@patch('core.config.TRE_ADDRESS_SPACE', "10.0.0.0/12") +@pytest.mark.parametrize("invalid_preset", ["huge", "extra_large", "invalid"]) +async def test_get_address_space_based_on_size_with_unrecognized_preset_raises_error(workspace_repo, basic_workspace_request, invalid_preset): + workspace_to_create = basic_workspace_request + workspace_to_create.properties["address_space_size"] = invalid_preset + with pytest.raises(InvalidInput) as ex: + await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) + assert str(ex.value) == f"Invalid 'address_space_size': {invalid_preset}" From 64c1ebd2d3d57470e1a37d619023c98eba69142f Mon Sep 17 00:00:00 2001 From: James Chapman Date: Wed, 22 Jul 2026 09:28:09 +0000 Subject: [PATCH 16/39] update workspace templates --- .../workspaces/airlock-import-review/porter.yaml | 2 +- .../airlock-import-review/template_schema.json | 13 +++++++++++-- templates/workspaces/base/porter.yaml | 2 +- templates/workspaces/base/template_schema.json | 15 ++++++++++++--- templates/workspaces/unrestricted/porter.yaml | 4 ++-- .../workspaces/unrestricted/template_schema.json | 13 +++++++++++-- 6 files changed, 38 insertions(+), 11 deletions(-) diff --git a/templates/workspaces/airlock-import-review/porter.yaml b/templates/workspaces/airlock-import-review/porter.yaml index 464a41d4f7..3e56028346 100644 --- a/templates/workspaces/airlock-import-review/porter.yaml +++ b/templates/workspaces/airlock-import-review/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-airlock-import-review -version: 0.15.0 +version: 0.15.1 description: "A workspace to do Airlock Data Import Reviews for Azure TRE" dockerfile: Dockerfile.tmpl registry: azuretre diff --git a/templates/workspaces/airlock-import-review/template_schema.json b/templates/workspaces/airlock-import-review/template_schema.json index 27ad22a5de..f77c4d0439 100644 --- a/templates/workspaces/airlock-import-review/template_schema.json +++ b/templates/workspaces/airlock-import-review/template_schema.json @@ -33,9 +33,18 @@ "address_space_size": { "type": "string", "title": "Address space size", - "description": "Network address size (small, medium, large or custom) to be used by the workspace.", - "default": "small", + "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP) to be used by the workspace.", + "default": "24", "enum": [ + "24", + "23", + "22", + "21", + "20", + "19", + "18", + "17", + "16", "small", "medium", "large", diff --git a/templates/workspaces/base/porter.yaml b/templates/workspaces/base/porter.yaml index 22cb6cdfc3..456e99b854 100644 --- a/templates/workspaces/base/porter.yaml +++ b/templates/workspaces/base/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-base -version: 2.8.4 +version: 2.8.5 description: "A base Azure TRE workspace" dockerfile: Dockerfile.tmpl registry: azuretre diff --git a/templates/workspaces/base/template_schema.json b/templates/workspaces/base/template_schema.json index c69024b8e8..65268b916c 100644 --- a/templates/workspaces/base/template_schema.json +++ b/templates/workspaces/base/template_schema.json @@ -49,9 +49,18 @@ "address_space_size": { "type": "string", "title": "Address space size", - "description": "Network address size (small, medium, large or custom) to be used by the workspace.", - "default": "small", + "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP) to be used by the workspace.", + "default": "24", "enum": [ + "24", + "23", + "22", + "21", + "20", + "19", + "18", + "17", + "16", "small", "medium", "large", @@ -357,4 +366,4 @@ "*" ] } -} \ No newline at end of file +} diff --git a/templates/workspaces/unrestricted/porter.yaml b/templates/workspaces/unrestricted/porter.yaml index bd4373b587..2ad099469c 100644 --- a/templates/workspaces/unrestricted/porter.yaml +++ b/templates/workspaces/unrestricted/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-unrestricted -version: 0.13.7 +version: 0.13.8 description: "A base Azure TRE workspace" dockerfile: Dockerfile.tmpl registry: azuretre @@ -125,7 +125,7 @@ parameters: - name: aad_redirect_uris type: string description: "List of redirect URIs in {name:value} format" - default: "W10=" # b64 for [] + default: "W10=" # b64 for [] - name: app_service_plan_sku type: string description: "The SKU used when deploying an Azure App Service Plan" diff --git a/templates/workspaces/unrestricted/template_schema.json b/templates/workspaces/unrestricted/template_schema.json index cea34ab8f4..ca302b96ff 100644 --- a/templates/workspaces/unrestricted/template_schema.json +++ b/templates/workspaces/unrestricted/template_schema.json @@ -41,9 +41,18 @@ "address_space_size": { "type": "string", "title": "Address space size", - "description": "Network address size (small, medium, large or custom) to be used by the workspace.", - "default": "small", + "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP) to be used by the workspace.", + "default": "24", "enum": [ + "24", + "23", + "22", + "21", + "20", + "19", + "18", + "17", + "16", "small", "medium", "large", From 881f496ca0d8ed3ca8bc8821e577bfc43aa33ec5 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Wed, 22 Jul 2026 09:30:09 +0000 Subject: [PATCH 17/39] update template --- templates/workspaces/airlock-import-review/template_schema.json | 2 +- templates/workspaces/base/template_schema.json | 2 +- templates/workspaces/unrestricted/template_schema.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/workspaces/airlock-import-review/template_schema.json b/templates/workspaces/airlock-import-review/template_schema.json index f77c4d0439..8a200e0530 100644 --- a/templates/workspaces/airlock-import-review/template_schema.json +++ b/templates/workspaces/airlock-import-review/template_schema.json @@ -34,7 +34,7 @@ "type": "string", "title": "Address space size", "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP) to be used by the workspace.", - "default": "24", + "default": "small", "enum": [ "24", "23", diff --git a/templates/workspaces/base/template_schema.json b/templates/workspaces/base/template_schema.json index 65268b916c..ad7d6fbbd8 100644 --- a/templates/workspaces/base/template_schema.json +++ b/templates/workspaces/base/template_schema.json @@ -50,7 +50,7 @@ "type": "string", "title": "Address space size", "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP) to be used by the workspace.", - "default": "24", + "default": "small", "enum": [ "24", "23", diff --git a/templates/workspaces/unrestricted/template_schema.json b/templates/workspaces/unrestricted/template_schema.json index ca302b96ff..e4bf81a5ff 100644 --- a/templates/workspaces/unrestricted/template_schema.json +++ b/templates/workspaces/unrestricted/template_schema.json @@ -42,7 +42,7 @@ "type": "string", "title": "Address space size", "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP) to be used by the workspace.", - "default": "24", + "default": "small", "enum": [ "24", "23", From 31e45ce47d6e6c22c815b244abc9f0bee66ea03b Mon Sep 17 00:00:00 2001 From: James Chapman Date: Wed, 22 Jul 2026 09:30:26 +0000 Subject: [PATCH 18/39] remove try catch --- api_app/db/repositories/workspaces.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/api_app/db/repositories/workspaces.py b/api_app/db/repositories/workspaces.py index ff1e407ce5..718d927ea9 100644 --- a/api_app/db/repositories/workspaces.py +++ b/api_app/db/repositories/workspaces.py @@ -174,16 +174,12 @@ async def get_address_space_based_on_size(self, workspace_properties: dict): raise InvalidInput("The custom 'address_space' you requested does not fit in the current network.") # If a numeric cidr was provided (e.g. as a string like "25"), accept it - try: - if address_space_size.isdigit(): - cidr_netmask = int(address_space_size) - # basic validation for reasonable CIDR mask values - if cidr_netmask < 16 or cidr_netmask > 29: - raise InvalidInput("'address_space_size' numeric value must be between 16 and 29") - return await self.get_new_address_space(cidr_netmask) - except ValueError: - # fall through to predefined handling - pass + if address_space_size.isdecimal(): + cidr_netmask = int(address_space_size) + # basic validation for reasonable CIDR mask values + if cidr_netmask < 16 or cidr_netmask > 29: + raise InvalidInput("'address_space_size' numeric value must be between 16 and 29") + return await self.get_new_address_space(cidr_netmask) if address_space_size in WorkspaceRepository.predefined_address_spaces: cidr_netmask = WorkspaceRepository.predefined_address_spaces[address_space_size] From a1f7feae6c9936b462bc4dcb273b667f99bb162e Mon Sep 17 00:00:00 2001 From: James Chapman Date: Wed, 22 Jul 2026 09:31:36 +0000 Subject: [PATCH 19/39] Adding a parametrized test for both None and "" to prevent regressions. --- .../test_db/test_repositories/test_workpaces_repository.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py index 9536421742..d124627303 100644 --- a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py +++ b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py @@ -461,9 +461,10 @@ async def test_get_address_space_based_on_size_with_invalid_string_raises_error( @patch('core.config.TRE_ID', "9876") @patch('core.config.CORE_ADDRESS_SPACE', "10.1.0.0/22") @patch('core.config.TRE_ADDRESS_SPACE', "10.0.0.0/12") -async def test_get_address_space_based_on_size_with_none_address_space_size(workspace_repo, basic_workspace_request): +@pytest.mark.parametrize("empty_size", [None, "", " "]) +async def test_get_address_space_based_on_size_with_none_or_empty_address_space_size(workspace_repo, basic_workspace_request, empty_size): workspace_to_create = basic_workspace_request - workspace_to_create.properties["address_space_size"] = None + workspace_to_create.properties["address_space_size"] = empty_size assert "10.1.4.0/24" == await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) From 1c6f9d805d1d97c71c548be3dba78f3f04ee4981 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Wed, 22 Jul 2026 09:59:20 +0000 Subject: [PATCH 20/39] version bump --- api_app/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_app/_version.py b/api_app/_version.py index 605b3cd20e..5a30a412a8 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.25.29" +__version__ = "0.25.30" From ece77098db8f62d87cce3785518282f6ebb9a649 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Wed, 22 Jul 2026 10:13:46 +0000 Subject: [PATCH 21/39] update descriptions --- api_app/models/schemas/workspace_template.py | 4 ++-- .../workspaces/airlock-import-review/template_schema.json | 2 +- templates/workspaces/base/template_schema.json | 2 +- templates/workspaces/unrestricted/template_schema.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api_app/models/schemas/workspace_template.py b/api_app/models/schemas/workspace_template.py index 9d68a3f1fd..1341e3f29e 100644 --- a/api_app/models/schemas/workspace_template.py +++ b/api_app/models/schemas/workspace_template.py @@ -22,7 +22,7 @@ def get_sample_workspace_template_object(template_name: str = "tre-workspace-bas "address_space_size": Property( type="string", default="small", - description="This can have a value of small, medium, large, a numeric CIDR mask (e.g. \"25\") or custom. If you specify custom, then you need to specify a VNet address space in 'address_space' (e.g. 10.2.1.0/24)") + description="This can have a value of small, medium, large, a numeric CIDR mask (e.g. \"24\") or custom. If you specify custom, then you need to specify a VNet address space in 'address_space' (e.g. 10.2.1.0/24)") }, customActions=[ CustomAction() @@ -73,7 +73,7 @@ class Config: "address_space_size": { "type": "string", "title": "Address space size", - "description": "This can have a value of small, medium, large, a numeric CIDR mask (e.g. \"25\") or custom. If you specify custom, then you need to specify a VNet address space in 'address_space' (e.g. 10.2.1.0/24)" + "description": "This can have a value of small, medium, large, a numeric CIDR mask (e.g. \"24\") or custom. If you specify custom, then you need to specify a VNet address space in 'address_space' (e.g. 10.2.1.0/24)" }, "address_space": { "type": "string", diff --git a/templates/workspaces/airlock-import-review/template_schema.json b/templates/workspaces/airlock-import-review/template_schema.json index 8a200e0530..f0a5953ef9 100644 --- a/templates/workspaces/airlock-import-review/template_schema.json +++ b/templates/workspaces/airlock-import-review/template_schema.json @@ -33,7 +33,7 @@ "address_space_size": { "type": "string", "title": "Address space size", - "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP) to be used by the workspace.", + "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP range e.g. 10.2.1.0/25) to be used by the workspace.", "default": "small", "enum": [ "24", diff --git a/templates/workspaces/base/template_schema.json b/templates/workspaces/base/template_schema.json index ad7d6fbbd8..84b7cfccaa 100644 --- a/templates/workspaces/base/template_schema.json +++ b/templates/workspaces/base/template_schema.json @@ -49,7 +49,7 @@ "address_space_size": { "type": "string", "title": "Address space size", - "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP) to be used by the workspace.", + "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP range e.g. 10.2.1.0/25) to be used by the workspace.", "default": "small", "enum": [ "24", diff --git a/templates/workspaces/unrestricted/template_schema.json b/templates/workspaces/unrestricted/template_schema.json index e4bf81a5ff..7c7fe8c3ad 100644 --- a/templates/workspaces/unrestricted/template_schema.json +++ b/templates/workspaces/unrestricted/template_schema.json @@ -41,7 +41,7 @@ "address_space_size": { "type": "string", "title": "Address space size", - "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP) to be used by the workspace.", + "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP range e.g. 10.2.1.0/25) to be used by the workspace.", "default": "small", "enum": [ "24", From f532f39faecfb8be2354bfddf7c3ec9c32596d5f Mon Sep 17 00:00:00 2001 From: James Chapman Date: Wed, 22 Jul 2026 10:19:51 +0000 Subject: [PATCH 22/39] typo --- docs/tre-workspace-authors/authoring-workspace-templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tre-workspace-authors/authoring-workspace-templates.md b/docs/tre-workspace-authors/authoring-workspace-templates.md index 1171f7d599..c7963161a0 100644 --- a/docs/tre-workspace-authors/authoring-workspace-templates.md +++ b/docs/tre-workspace-authors/authoring-workspace-templates.md @@ -103,7 +103,7 @@ The mandatory parameters for workspace services are: | `tre_id` | string | Unique ID of for the TRE instance. | `tre-dev-42` | | `workspace_id` | string | Unique 4-character long, alphanumeric workspace ID. | `0a9e` | -### Workpace services requiring additional address spaces +### Workspace services requiring additional address spaces Some workspace services may require additional address spaces to be provisioned. This may be necessary if they need advanced network security groups, route tables or delegated subnets. From d1179d2bc341e016ee228890d14e0a07903bfca1 Mon Sep 17 00:00:00 2001 From: James Chapman <196318169+JC-wk@users.noreply.github.com> Date: Wed, 22 Jul 2026 11:30:29 +0100 Subject: [PATCH 23/39] copilot suggestion Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- api_app/db/repositories/workspaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_app/db/repositories/workspaces.py b/api_app/db/repositories/workspaces.py index 718d927ea9..5c78e693c0 100644 --- a/api_app/db/repositories/workspaces.py +++ b/api_app/db/repositories/workspaces.py @@ -185,7 +185,7 @@ async def get_address_space_based_on_size(self, workspace_properties: dict): cidr_netmask = WorkspaceRepository.predefined_address_spaces[address_space_size] return await self.get_new_address_space(cidr_netmask) - raise InvalidInput(f"Invalid 'address_space_size': {raw_size}") + raise InvalidInput(f"Invalid 'address_space_size': {address_space_size}") # 772 check that the provided address_space is available in the network. async def validate_address_space(self, address_space): From c4f6318541617861679a3b34ec179c3c6fc4fea2 Mon Sep 17 00:00:00 2001 From: James Chapman <196318169+JC-wk@users.noreply.github.com> Date: Wed, 22 Jul 2026 11:31:35 +0100 Subject: [PATCH 24/39] copilot suggestion Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/tre-workspace-authors/authoring-workspace-templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tre-workspace-authors/authoring-workspace-templates.md b/docs/tre-workspace-authors/authoring-workspace-templates.md index c7963161a0..516cbb6e22 100644 --- a/docs/tre-workspace-authors/authoring-workspace-templates.md +++ b/docs/tre-workspace-authors/authoring-workspace-templates.md @@ -110,7 +110,7 @@ Some workspace services may require additional address spaces to be provisioned. To request an additional address space, the workspace service bundle must define an `address_space` parameter in the `porter.yaml` file. The value of this parameter will be provided by API to the resource processor. The size of the `address_space` will default to `/24`, however other sizes can be requested by including an `address_space_size` as part of the workspace service template. -This parameter accepts the presets `small` (/24), `medium` (/22), `large` (/16), the literal value `custom` together with an explicit `address_space` CIDR (e.g. `10.2.1.0/25`), or a numeric CIDR mask as a string from "16" to "29" (e.g. `"25"`) to ask the system to auto-select an available `/25`. +This parameter accepts the presets `small` (/24), `medium` (/22), `large` (/16), the literal value `custom` together with an explicit `address_space` CIDR (e.g. `10.2.1.0/25`), or (for workspace services) a numeric CIDR mask as a string from "16" to "29" (e.g. `"25"`) to ask the system to auto-select an available `/25`. Workspace templates may further restrict the allowed values via their JSON Schema. The `address_space` allocation will only take place during the install phase of a deployment, as this is a breaking change to your template you should increment the major version of your template, this means a you must deploy a new resource instead of upgrading an existing one. From 466e743c62cabe90b7b361235173a79d39b258a4 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Wed, 22 Jul 2026 10:34:16 +0000 Subject: [PATCH 25/39] update description --- templates/workspaces/airlock-import-review/template_schema.json | 2 +- templates/workspaces/base/template_schema.json | 2 +- templates/workspaces/unrestricted/template_schema.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/workspaces/airlock-import-review/template_schema.json b/templates/workspaces/airlock-import-review/template_schema.json index f0a5953ef9..f3a9fd4a19 100644 --- a/templates/workspaces/airlock-import-review/template_schema.json +++ b/templates/workspaces/airlock-import-review/template_schema.json @@ -33,7 +33,7 @@ "address_space_size": { "type": "string", "title": "Address space size", - "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP range e.g. 10.2.1.0/25) to be used by the workspace.", + "description": "Network address size as a CIDR value or (small /24, medium /22, large /16 or custom with an IP range e.g. 10.2.1.0/25) to be used by the workspace.", "default": "small", "enum": [ "24", diff --git a/templates/workspaces/base/template_schema.json b/templates/workspaces/base/template_schema.json index 84b7cfccaa..bf4d692a8d 100644 --- a/templates/workspaces/base/template_schema.json +++ b/templates/workspaces/base/template_schema.json @@ -49,7 +49,7 @@ "address_space_size": { "type": "string", "title": "Address space size", - "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP range e.g. 10.2.1.0/25) to be used by the workspace.", + "description": "Network address size as a CIDR value or (small /24, medium /22, large /16 or custom with an IP range e.g. 10.2.1.0/25) to be used by the workspace.", "default": "small", "enum": [ "24", diff --git a/templates/workspaces/unrestricted/template_schema.json b/templates/workspaces/unrestricted/template_schema.json index 7c7fe8c3ad..9607f490ec 100644 --- a/templates/workspaces/unrestricted/template_schema.json +++ b/templates/workspaces/unrestricted/template_schema.json @@ -41,7 +41,7 @@ "address_space_size": { "type": "string", "title": "Address space size", - "description": "Network address size cidr or (small /24, medium /22, large /16 or custom with an IP range e.g. 10.2.1.0/25) to be used by the workspace.", + "description": "Network address size as a CIDR value or (small /24, medium /22, large /16 or custom with an IP range e.g. 10.2.1.0/25) to be used by the workspace.", "default": "small", "enum": [ "24", From 92a629c10b688ee54227edfd699dbd23140eff17 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Thu, 23 Jul 2026 09:51:22 +0000 Subject: [PATCH 26/39] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca9399693a..22954a2755 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ ENHANCEMENTS: * Specify default_outbound_access_enabled = false setting for all subnets ([#4757](https://github.com/microsoft/AzureTRE/pull/4757)) * Pin all GitHub Actions workflow steps to full commit SHAs to prevent supply chain attacks plus update to latest releases ([#4886](https://github.com/microsoft/AzureTRE/pull/4886)) -* Allow numeric CIDR masks in `address_space_size` (e.g. "25") when requesting auto-assigned address spaces; accepts numeric strings and validates the mask range. ([#4733](https://github.com/microsoft/AzureTRE/issues/4733)) +* Allow numeric CIDR masks in `address_space_size` (e.g. "23") when requesting auto-assigned address spaces; accepts numeric strings and validates the mask range. ([#4733](https://github.com/microsoft/AzureTRE/issues/4733)) * Add Windows Server 2025 image support to Guacamole. ([#4890](https://github.com/microsoft/AzureTRE/issues/4890)) * Add support for setting resource processor VMSS SKU via environment variables ([#4936](https://github.com/microsoft/AzureTRE/issues/4936)) * Exclude recovery service vaults from e2e tests ([#4920](https://github.com/microsoft/AzureTRE/issues/4920)) From 3a1ca5f0d610eaee1e481e2347668d527b46b4f4 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Thu, 23 Jul 2026 12:12:05 +0000 Subject: [PATCH 27/39] update wording to match templates --- api_app/models/schemas/workspace_template.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api_app/models/schemas/workspace_template.py b/api_app/models/schemas/workspace_template.py index 1341e3f29e..1ed320430f 100644 --- a/api_app/models/schemas/workspace_template.py +++ b/api_app/models/schemas/workspace_template.py @@ -22,7 +22,7 @@ def get_sample_workspace_template_object(template_name: str = "tre-workspace-bas "address_space_size": Property( type="string", default="small", - description="This can have a value of small, medium, large, a numeric CIDR mask (e.g. \"24\") or custom. If you specify custom, then you need to specify a VNet address space in 'address_space' (e.g. 10.2.1.0/24)") + description="Network address size as a CIDR value or (small /24, medium /22, large /16 or custom with an IP range e.g. 10.2.1.0/25) to be used by the workspace.") }, customActions=[ CustomAction() @@ -73,7 +73,7 @@ class Config: "address_space_size": { "type": "string", "title": "Address space size", - "description": "This can have a value of small, medium, large, a numeric CIDR mask (e.g. \"24\") or custom. If you specify custom, then you need to specify a VNet address space in 'address_space' (e.g. 10.2.1.0/24)" + "description": "Network address size as a CIDR value or (small /24, medium /22, large /16 or custom with an IP range e.g. 10.2.1.0/25) to be used by the workspace." }, "address_space": { "type": "string", From 53398a0dd7fafa94016ffbbb86c19086b1140f95 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 4 Aug 2026 14:09:07 +0000 Subject: [PATCH 28/39] increase minor version instead of patch version --- api_app/_version.py | 2 +- templates/workspaces/airlock-import-review/porter.yaml | 2 +- templates/workspaces/base/porter.yaml | 2 +- templates/workspaces/unrestricted/porter.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api_app/_version.py b/api_app/_version.py index 025f4c5d0b..cde6d8971d 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.26.1" +__version__ = "0.27.0" diff --git a/templates/workspaces/airlock-import-review/porter.yaml b/templates/workspaces/airlock-import-review/porter.yaml index 617c611270..2557f0bc13 100644 --- a/templates/workspaces/airlock-import-review/porter.yaml +++ b/templates/workspaces/airlock-import-review/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-airlock-import-review -version: 0.16.1 +version: 0.17.0 description: "A workspace to do Airlock Data Import Reviews for Azure TRE" dockerfile: Dockerfile.tmpl registry: azuretre diff --git a/templates/workspaces/base/porter.yaml b/templates/workspaces/base/porter.yaml index 8dcd3c418e..0859c566c1 100644 --- a/templates/workspaces/base/porter.yaml +++ b/templates/workspaces/base/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-base -version: 2.10.1 +version: 2.11.0 description: "A base Azure TRE workspace" dockerfile: Dockerfile.tmpl registry: azuretre diff --git a/templates/workspaces/unrestricted/porter.yaml b/templates/workspaces/unrestricted/porter.yaml index e3c0848e0b..42f3827f35 100644 --- a/templates/workspaces/unrestricted/porter.yaml +++ b/templates/workspaces/unrestricted/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-unrestricted -version: 0.14.1 +version: 0.15.0 description: "A base Azure TRE workspace" dockerfile: Dockerfile.tmpl registry: azuretre From e1282ee5901a7fe703d34c87f4d1ba2a35bf1f54 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 4 Aug 2026 14:45:20 +0000 Subject: [PATCH 29/39] feat: enhance address space validation and update documentation for CIDR allocation --- api_app/api/routes/workspaces.py | 5 ++++- .../test_api/test_routes/test_workspaces.py | 20 ++++++++++++++++++- .../authoring-workspace-templates.md | 6 +++++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/api_app/api/routes/workspaces.py b/api_app/api/routes/workspaces.py index 04ea2d6513..bfc7a147fc 100644 --- a/api_app/api/routes/workspaces.py +++ b/api_app/api/routes/workspaces.py @@ -262,7 +262,10 @@ async def create_workspace_service(response: Response, workspace_service_input: # check workspace has address_spaces property if not workspace.properties.get("address_spaces"): raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=strings.WORKSPACE_DOES_NOT_HAVE_ADDRESS_SPACES_PROPERTY) - workspace_service.properties["address_space"] = await workspace_repo.get_address_space_based_on_size(workspace_service_input.properties) + try: + workspace_service.properties["address_space"] = await workspace_repo.get_address_space_based_on_size(workspace_service_input.properties) + except InvalidInput as e: + raise HTTPException(status_code=status.HTTP_422_UNPROCESSABLE_CONTENT, detail=str(e)) workspace_patch = ResourcePatch() workspace_patch.properties = {"address_spaces": workspace.properties["address_spaces"] + [workspace_service.properties["address_space"]]} # IP address allocation is managed by the API. Ideally this request would happen as a result of the workspace diff --git a/api_app/tests_ma/test_api/test_routes/test_workspaces.py b/api_app/tests_ma/test_api/test_routes/test_workspaces.py index 8eb8fd8a53..cb4754aa55 100644 --- a/api_app/tests_ma/test_api/test_routes/test_workspaces.py +++ b/api_app/tests_ma/test_api/test_routes/test_workspaces.py @@ -12,7 +12,7 @@ from models.domain.resource_template import ResourceTemplate from models.schemas.operation import OperationInResponse -from db.errors import EntityDoesNotExist, StorageAccountNameGenerationTimeout, StorageAccountNameCheckFailed +from db.errors import EntityDoesNotExist, InvalidInput, StorageAccountNameGenerationTimeout, StorageAccountNameCheckFailed from db.repositories.workspaces import WorkspaceRepository from db.repositories.workspace_services import WorkspaceServiceRepository from models.domain.authentication import RoleAssignment @@ -801,6 +801,24 @@ async def test_post_workspace_services_creates_workspace_service_with_address_sp assert response.status_code == status.HTTP_202_ACCEPTED assert response.json()["operation"]["resourceId"] == SERVICE_ID + # [POST] /workspaces/{workspace_id}/workspace-services + @patch("api.dependencies.workspaces.WorkspaceRepository.get_address_space_based_on_size", side_effect=InvalidInput("'address_space_size' numeric value must be between 16 and 29")) + @patch("api.dependencies.workspaces.WorkspaceRepository.get_workspace_by_id") + @patch("api.routes.workspaces.OperationRepository.resource_has_deployed_operation", return_value=True) + @patch("api.routes.workspaces.WorkspaceServiceRepository.create_workspace_service_item") + async def test_post_workspace_services_returns_422_for_invalid_address_space_size(self, create_workspace_service_item_mock, _, get_workspace_mock, __, app, client, workspace_service_input, basic_workspace_service_template): + workspace = sample_workspace() + workspace.properties["address_spaces"] = ["192.168.0.1/24"] + get_workspace_mock.return_value = workspace + basic_workspace_service_template.properties["address_space"] = "10.1.0.0/24" + create_workspace_service_item_mock.return_value = [sample_workspace_service(), basic_workspace_service_template] + workspace_service_input["properties"]["address_space_size"] = "15" + + response = await client.post(app.url_path_for(strings.API_CREATE_WORKSPACE_SERVICE, workspace_id=WORKSPACE_ID), json=workspace_service_input) + + assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT + assert response.text == "'address_space_size' numeric value must be between 16 and 29" + # [POST] /workspaces/{workspace_id}/workspace-services @patch("api.dependencies.workspaces.WorkspaceRepository.get_new_address_space", return_value="10.1.4.0/24") @patch("api.routes.workspaces.ResourceTemplateRepository.get_template_by_name_and_version") diff --git a/docs/tre-workspace-authors/authoring-workspace-templates.md b/docs/tre-workspace-authors/authoring-workspace-templates.md index 516cbb6e22..ac7d55bba8 100644 --- a/docs/tre-workspace-authors/authoring-workspace-templates.md +++ b/docs/tre-workspace-authors/authoring-workspace-templates.md @@ -110,7 +110,11 @@ Some workspace services may require additional address spaces to be provisioned. To request an additional address space, the workspace service bundle must define an `address_space` parameter in the `porter.yaml` file. The value of this parameter will be provided by API to the resource processor. The size of the `address_space` will default to `/24`, however other sizes can be requested by including an `address_space_size` as part of the workspace service template. -This parameter accepts the presets `small` (/24), `medium` (/22), `large` (/16), the literal value `custom` together with an explicit `address_space` CIDR (e.g. `10.2.1.0/25`), or (for workspace services) a numeric CIDR mask as a string from "16" to "29" (e.g. `"25"`) to ask the system to auto-select an available `/25`. Workspace templates may further restrict the allowed values via their JSON Schema. +This parameter accepts the presets `small` (/24), `medium` (/22), `large` (/16), the literal value `custom` together with an explicit `address_space` CIDR (e.g. `10.2.1.0/25`), or a numeric CIDR mask as a string. +The API has support for allocating CIDR subnet masks from "16" to "29". Workspace templates are configured to support from "16" (65,536 IP addresses) to "24" (256 IP addresses). +Depending on the workspace service you are deploying you may configure a template with a CIDR up to "29" which only has 6 usable IP addresses. +The workspace service IP addresses are in addition to the workspace addresses and the address size is unrelated to the workspace IP address size. +The workspace will be patched to add the additional address space to its vnet. The `address_space` allocation will only take place during the install phase of a deployment, as this is a breaking change to your template you should increment the major version of your template, this means a you must deploy a new resource instead of upgrading an existing one. From bca3646acd38791ef5969eddd6f666669a673524 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 4 Aug 2026 15:01:22 +0000 Subject: [PATCH 30/39] docs --- docs/tre-workspace-authors/authoring-workspace-templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tre-workspace-authors/authoring-workspace-templates.md b/docs/tre-workspace-authors/authoring-workspace-templates.md index ac7d55bba8..433964aca7 100644 --- a/docs/tre-workspace-authors/authoring-workspace-templates.md +++ b/docs/tre-workspace-authors/authoring-workspace-templates.md @@ -112,7 +112,7 @@ To request an additional address space, the workspace service bundle must define The size of the `address_space` will default to `/24`, however other sizes can be requested by including an `address_space_size` as part of the workspace service template. This parameter accepts the presets `small` (/24), `medium` (/22), `large` (/16), the literal value `custom` together with an explicit `address_space` CIDR (e.g. `10.2.1.0/25`), or a numeric CIDR mask as a string. The API has support for allocating CIDR subnet masks from "16" to "29". Workspace templates are configured to support from "16" (65,536 IP addresses) to "24" (256 IP addresses). -Depending on the workspace service you are deploying you may configure a template with a CIDR up to "29" which only has 6 usable IP addresses. +Depending on the workspace service you are deploying you may configure a template with a CIDR up to "29" which only has only 3 usable IP addresses as Azure reserves the first four and last address of every subnet. The workspace service IP addresses are in addition to the workspace addresses and the address size is unrelated to the workspace IP address size. The workspace will be patched to add the additional address space to its vnet. From 8280ea2357a4f1fd9beb331e5d026ed64c3f7adc Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 4 Aug 2026 15:15:03 +0000 Subject: [PATCH 31/39] typo --- docs/tre-workspace-authors/authoring-workspace-templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tre-workspace-authors/authoring-workspace-templates.md b/docs/tre-workspace-authors/authoring-workspace-templates.md index 433964aca7..9715c17026 100644 --- a/docs/tre-workspace-authors/authoring-workspace-templates.md +++ b/docs/tre-workspace-authors/authoring-workspace-templates.md @@ -112,7 +112,7 @@ To request an additional address space, the workspace service bundle must define The size of the `address_space` will default to `/24`, however other sizes can be requested by including an `address_space_size` as part of the workspace service template. This parameter accepts the presets `small` (/24), `medium` (/22), `large` (/16), the literal value `custom` together with an explicit `address_space` CIDR (e.g. `10.2.1.0/25`), or a numeric CIDR mask as a string. The API has support for allocating CIDR subnet masks from "16" to "29". Workspace templates are configured to support from "16" (65,536 IP addresses) to "24" (256 IP addresses). -Depending on the workspace service you are deploying you may configure a template with a CIDR up to "29" which only has only 3 usable IP addresses as Azure reserves the first four and last address of every subnet. +Depending on the workspace service you are deploying you may configure a template with a CIDR up to "29" which has only 3 usable IP addresses as Azure reserves the first four and last address of every subnet. The workspace service IP addresses are in addition to the workspace addresses and the address size is unrelated to the workspace IP address size. The workspace will be patched to add the additional address space to its vnet. From 38e67df4f5bdaa71f146b4a30b6cdc5a7b4a971e Mon Sep 17 00:00:00 2001 From: James Chapman <196318169+JC-wk@users.noreply.github.com> Date: Mon, 17 Aug 2026 14:14:14 +0100 Subject: [PATCH 32/39] Update CHANGELOG.md with new enhancements and fixes --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cae33fe079..621a8d27a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ **BREAKING CHANGES** ENHANCEMENTS: +* Allow numeric CIDR masks in `address_space_size` (e.g. "23") when requesting auto-assigned address spaces; accepts numeric strings and validates the mask range. ([#4733](https://github.com/microsoft/AzureTRE/issues/4733)) ## (0.29.0) (August 14, 2026) **BREAKING CHANGES** @@ -15,7 +16,6 @@ ENHANCEMENTS: * Enable graceful upgrading of the Nexus shared service: modified or added repository configs and the container image (now `3.94.0`) are applied to the existing VM on upgrade without recreating it. Removed the non-functional `snapcraft` proxy (dead remote URL) and skip repositories left in a failed state so they don't block upgrades. (`sonatype-nexus` 3.10.0) ([#2721](https://github.com/microsoft/AzureTRE/issues/2721)) * Specify default_outbound_access_enabled = false setting for all subnets ([#4757](https://github.com/microsoft/AzureTRE/pull/4757)) * Pin all GitHub Actions workflow steps to full commit SHAs to prevent supply chain attacks plus update to latest releases ([#4886](https://github.com/microsoft/AzureTRE/pull/4886)) -* Allow numeric CIDR masks in `address_space_size` (e.g. "23") when requesting auto-assigned address spaces; accepts numeric strings and validates the mask range. ([#4733](https://github.com/microsoft/AzureTRE/issues/4733)) * Add Windows Server 2025 image support to Guacamole. ([#4890](https://github.com/microsoft/AzureTRE/issues/4890)) * Add support for setting resource processor VMSS SKU via environment variables ([#4936](https://github.com/microsoft/AzureTRE/issues/4936)) * Exclude recovery service vaults from e2e tests ([#4920](https://github.com/microsoft/AzureTRE/issues/4920)) From 04f4cf4811d5c63d8271facd8cc86f13d9297866 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Fri, 21 Aug 2026 09:44:33 +0000 Subject: [PATCH 33/39] Track pending workspace address spaces during service uninstall --- api_app/db/repositories/workspaces.py | 1 + .../service_bus/deployment_status_updater.py | 92 +++++++++++++++++++ .../test_workpaces_repository.py | 5 +- 3 files changed, 97 insertions(+), 1 deletion(-) diff --git a/api_app/db/repositories/workspaces.py b/api_app/db/repositories/workspaces.py index d36788a9be..2592b9681a 100644 --- a/api_app/db/repositories/workspaces.py +++ b/api_app/db/repositories/workspaces.py @@ -199,6 +199,7 @@ async def get_new_address_space(self, cidr_netmask: int = 24): workspaces = await self.get_active_workspaces() networks = [[x.properties.get("address_space")] for x in workspaces] networks = networks + [x.properties.get("address_spaces", []) for x in workspaces] + networks = networks + [x.properties.get("pending_address_spaces", []) for x in workspaces] networks = [i for s in networks for i in s if i is not None] new_address_space = generate_new_cidr(networks, cidr_netmask) diff --git a/api_app/service_bus/deployment_status_updater.py b/api_app/service_bus/deployment_status_updater.py index 702f878892..4bed196039 100644 --- a/api_app/service_bus/deployment_status_updater.py +++ b/api_app/service_bus/deployment_status_updater.py @@ -14,15 +14,22 @@ from azure.servicebus import NEXT_AVAILABLE_SESSION from azure.servicebus.exceptions import OperationTimeoutError, ServiceBusConnectionError from azure.servicebus.aio import ServiceBusClient, AutoLockRenewer +from azure.cosmos.exceptions import CosmosAccessConditionFailedError from db.repositories.operations import OperationRepository +from db.repositories.workspaces import WorkspaceRepository from core import config, credentials from db.errors import EntityDoesNotExist from db.repositories.resources import ResourceRepository from models.domain.operation import DeploymentStatusUpdateMessage, Operation, OperationStep, Status +from models.domain.resource import ResourceType +from models.schemas.resource import ResourcePatch from resources import strings from services.logging import logger, tracer +MAX_CLEANUP_RETRIES = 3 + + class DeploymentStatusUpdater(): def __init__(self): pass @@ -30,6 +37,7 @@ def __init__(self): async def init_repos(self): self.operations_repo = await OperationRepository.create() self.resource_repo = await ResourceRepository.create() + self.workspace_repo = await WorkspaceRepository.create() self.resource_template_repo = await ResourceTemplateRepository.create() self.resource_history_repo = await ResourceHistoryRepository.create() @@ -157,6 +165,20 @@ async def update_status_in_database(self, message: DeploymentStatusUpdateMessage resource_to_persist = self.create_updated_resource_document(resource, message) await self.resource_repo.update_item_dict(resource_to_persist) + if (step_to_update.resourceType == ResourceType.Workspace + and step_to_update.resourceAction == RequestAction.Upgrade + and operation.action == RequestAction.UnInstall): + if not await self._finalize_pending_workspace_address_space(resource_to_persist, operation): + return False + + if (step_to_update.templateStepId == "main" + and operation.action == RequestAction.UnInstall + and step_to_update.resourceType == ResourceType.WorkspaceService): + cleanup_succeeded = await self._finalize_workspace_address_space(resource_to_persist, operation) \ + if is_last_step else await self._mark_workspace_address_space_pending(resource_to_persist, operation) + if not cleanup_succeeded: + return False + # more steps in the op to do? if is_last_step is False: assert current_step_index < (len(operation.steps) - 1) @@ -199,6 +221,76 @@ async def update_status_in_database(self, message: DeploymentStatusUpdateMessage return result + async def _mark_workspace_address_space_pending(self, resource_to_persist: dict, operation: Operation) -> bool: + address_to_hold = resource_to_persist.get("properties", {}).get("address_space") + parent_workspace_id = resource_to_persist.get("workspaceId") + if not address_to_hold or not parent_workspace_id: + return True + + def update_properties(workspace): + pending_address_spaces = workspace.properties.get("pending_address_spaces", []) + if address_to_hold not in pending_address_spaces: + pending_address_spaces.append(address_to_hold) + return {"pending_address_spaces": pending_address_spaces} + + return await self._patch_workspace_address_spaces(parent_workspace_id, update_properties, operation) + + async def _finalize_pending_workspace_address_space(self, workspace_resource: dict, operation: Operation) -> bool: + main_step = next((step for step in operation.steps if step.templateStepId == "main"), None) + if main_step is None: + return True + + workspace_service = await self.resource_repo.get_resource_dict_by_id(uuid.UUID(main_step.resourceId)) + address_to_free = workspace_service.get("properties", {}).get("address_space") + if not address_to_free: + return True + + def update_properties(workspace): + address_spaces = [address for address in workspace.properties.get("address_spaces", []) if address != address_to_free] + pending_address_spaces = [address for address in workspace.properties.get("pending_address_spaces", []) if address != address_to_free] + return {"address_spaces": address_spaces, "pending_address_spaces": pending_address_spaces} + + return await self._patch_workspace_address_spaces(workspace_resource["id"], update_properties, operation) + + async def _finalize_workspace_address_space(self, resource_to_persist: dict, operation: Operation) -> bool: + address_to_free = resource_to_persist.get("properties", {}).get("address_space") + parent_workspace_id = resource_to_persist.get("workspaceId") + if not address_to_free or not parent_workspace_id: + return True + + def update_properties(workspace): + address_spaces = [address for address in workspace.properties.get("address_spaces", []) if address != address_to_free] + pending_address_spaces = [address for address in workspace.properties.get("pending_address_spaces", []) if address != address_to_free] + return {"address_spaces": address_spaces, "pending_address_spaces": pending_address_spaces} + + return await self._patch_workspace_address_spaces(parent_workspace_id, update_properties, operation) + + async def _patch_workspace_address_spaces(self, workspace_id: str, update_properties, operation: Operation) -> bool: + try: + for attempt in range(MAX_CLEANUP_RETRIES): + try: + workspace = await self.workspace_repo.get_workspace_by_id(workspace_id) + workspace_patch = ResourcePatch() + workspace_patch.properties = update_properties(workspace) + await self.workspace_repo.patch_workspace( + workspace, + workspace_patch, + workspace.etag, + self.resource_template_repo, + self.resource_history_repo, + operation.user, + False) + return True + except CosmosAccessConditionFailedError: + if attempt == MAX_CLEANUP_RETRIES - 1: + raise + logger.warning(f"ETag conflict updating workspace address space state. Retrying (attempt {attempt + 1}/{MAX_CLEANUP_RETRIES})...") + except Exception: + logger.exception(f"[ADDRESS_SPACE_CLEANUP_FAILED] Failed to update address space state for workspace {workspace_id}") + return False + + return False + async def update_overall_operation_status(self, operation: Operation, step: OperationStep, is_last_step: bool): operation.updatedWhen = get_timestamp() diff --git a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py index 114ee64f38..2263b38653 100644 --- a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py +++ b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py @@ -268,7 +268,10 @@ async def test_get_address_space_based_on_size_with_address_space_and_address_sp workspace_with_both.properties["address_spaces"] = ["10.1.7.0/24", "10.1.8.0/24"] workspace_with_both.properties["address_space"] = "10.1.7.0/24" - get_active_workspaces_mock.return_value = [workspace_with_address_space, workspace_with_address_spaces, workspace_with_both] + workspace_with_pending_address_space = copy.deepcopy(workspace) + workspace_with_pending_address_space.properties["pending_address_spaces"] = ["10.1.8.0/24"] + + get_active_workspaces_mock.return_value = [workspace_with_address_space, workspace_with_address_spaces, workspace_with_both, workspace_with_pending_address_space] workspace_to_create = basic_workspace_request address_space = await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) From d367fefb68a53db234ee031b4964840e3327abd2 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Fri, 21 Aug 2026 12:02:06 +0000 Subject: [PATCH 34/39] Remove pending workspace address space tracking --- api_app/db/repositories/workspaces.py | 1 - .../service_bus/deployment_status_updater.py | 44 +------------- .../test_workpaces_repository.py | 5 +- .../test_deployment_status_update.py | 57 +++++++++++++++++++ 4 files changed, 60 insertions(+), 47 deletions(-) diff --git a/api_app/db/repositories/workspaces.py b/api_app/db/repositories/workspaces.py index 2592b9681a..d36788a9be 100644 --- a/api_app/db/repositories/workspaces.py +++ b/api_app/db/repositories/workspaces.py @@ -199,7 +199,6 @@ async def get_new_address_space(self, cidr_netmask: int = 24): workspaces = await self.get_active_workspaces() networks = [[x.properties.get("address_space")] for x in workspaces] networks = networks + [x.properties.get("address_spaces", []) for x in workspaces] - networks = networks + [x.properties.get("pending_address_spaces", []) for x in workspaces] networks = [i for s in networks for i in s if i is not None] new_address_space = generate_new_cidr(networks, cidr_netmask) diff --git a/api_app/service_bus/deployment_status_updater.py b/api_app/service_bus/deployment_status_updater.py index 4bed196039..2bb16a9e50 100644 --- a/api_app/service_bus/deployment_status_updater.py +++ b/api_app/service_bus/deployment_status_updater.py @@ -165,18 +165,10 @@ async def update_status_in_database(self, message: DeploymentStatusUpdateMessage resource_to_persist = self.create_updated_resource_document(resource, message) await self.resource_repo.update_item_dict(resource_to_persist) - if (step_to_update.resourceType == ResourceType.Workspace - and step_to_update.resourceAction == RequestAction.Upgrade - and operation.action == RequestAction.UnInstall): - if not await self._finalize_pending_workspace_address_space(resource_to_persist, operation): - return False - if (step_to_update.templateStepId == "main" and operation.action == RequestAction.UnInstall and step_to_update.resourceType == ResourceType.WorkspaceService): - cleanup_succeeded = await self._finalize_workspace_address_space(resource_to_persist, operation) \ - if is_last_step else await self._mark_workspace_address_space_pending(resource_to_persist, operation) - if not cleanup_succeeded: + if not await self._finalize_workspace_address_space(resource_to_persist, operation): return False # more steps in the op to do? @@ -221,37 +213,6 @@ async def update_status_in_database(self, message: DeploymentStatusUpdateMessage return result - async def _mark_workspace_address_space_pending(self, resource_to_persist: dict, operation: Operation) -> bool: - address_to_hold = resource_to_persist.get("properties", {}).get("address_space") - parent_workspace_id = resource_to_persist.get("workspaceId") - if not address_to_hold or not parent_workspace_id: - return True - - def update_properties(workspace): - pending_address_spaces = workspace.properties.get("pending_address_spaces", []) - if address_to_hold not in pending_address_spaces: - pending_address_spaces.append(address_to_hold) - return {"pending_address_spaces": pending_address_spaces} - - return await self._patch_workspace_address_spaces(parent_workspace_id, update_properties, operation) - - async def _finalize_pending_workspace_address_space(self, workspace_resource: dict, operation: Operation) -> bool: - main_step = next((step for step in operation.steps if step.templateStepId == "main"), None) - if main_step is None: - return True - - workspace_service = await self.resource_repo.get_resource_dict_by_id(uuid.UUID(main_step.resourceId)) - address_to_free = workspace_service.get("properties", {}).get("address_space") - if not address_to_free: - return True - - def update_properties(workspace): - address_spaces = [address for address in workspace.properties.get("address_spaces", []) if address != address_to_free] - pending_address_spaces = [address for address in workspace.properties.get("pending_address_spaces", []) if address != address_to_free] - return {"address_spaces": address_spaces, "pending_address_spaces": pending_address_spaces} - - return await self._patch_workspace_address_spaces(workspace_resource["id"], update_properties, operation) - async def _finalize_workspace_address_space(self, resource_to_persist: dict, operation: Operation) -> bool: address_to_free = resource_to_persist.get("properties", {}).get("address_space") parent_workspace_id = resource_to_persist.get("workspaceId") @@ -260,8 +221,7 @@ async def _finalize_workspace_address_space(self, resource_to_persist: dict, ope def update_properties(workspace): address_spaces = [address for address in workspace.properties.get("address_spaces", []) if address != address_to_free] - pending_address_spaces = [address for address in workspace.properties.get("pending_address_spaces", []) if address != address_to_free] - return {"address_spaces": address_spaces, "pending_address_spaces": pending_address_spaces} + return {"address_spaces": address_spaces} return await self._patch_workspace_address_spaces(parent_workspace_id, update_properties, operation) diff --git a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py index 2263b38653..114ee64f38 100644 --- a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py +++ b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py @@ -268,10 +268,7 @@ async def test_get_address_space_based_on_size_with_address_space_and_address_sp workspace_with_both.properties["address_spaces"] = ["10.1.7.0/24", "10.1.8.0/24"] workspace_with_both.properties["address_space"] = "10.1.7.0/24" - workspace_with_pending_address_space = copy.deepcopy(workspace) - workspace_with_pending_address_space.properties["pending_address_spaces"] = ["10.1.8.0/24"] - - get_active_workspaces_mock.return_value = [workspace_with_address_space, workspace_with_address_spaces, workspace_with_both, workspace_with_pending_address_space] + get_active_workspaces_mock.return_value = [workspace_with_address_space, workspace_with_address_spaces, workspace_with_both] workspace_to_create = basic_workspace_request address_space = await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) diff --git a/api_app/tests_ma/test_service_bus/test_deployment_status_update.py b/api_app/tests_ma/test_service_bus/test_deployment_status_update.py index 16a63937aa..d1941777e3 100644 --- a/api_app/tests_ma/test_service_bus/test_deployment_status_update.py +++ b/api_app/tests_ma/test_service_bus/test_deployment_status_update.py @@ -392,6 +392,63 @@ async def test_multi_step_operation_ends_at_last_step(sb_sender_client, resource sb_sender_client().get_queue_sender().send_messages.assert_not_called() +@patch('service_bus.deployment_status_updater.send_deployment_message') +@patch('service_bus.deployment_status_updater.update_resource_for_step') +async def test_workspace_address_space_is_not_finalized_before_main_uninstall( + update_resource_for_step, send_deployment_message): + workspace_id = uuid.UUID(test_sb_message["id"]) + operation = Operation( + id=OPERATION_ID, + resourceId=str(workspace_id), + resourcePath=f'/workspaces/{workspace_id}', + action=RequestAction.UnInstall, + steps=[ + OperationStep( + id="workspace-upgrade", + templateStepId="workspace-upgrade", + resourceId=str(workspace_id), + resourceType=ResourceType.Workspace, + resourceAction=RequestAction.Upgrade, + status=Status.Updating, + sourceTemplateResourceId=str(workspace_id)), + OperationStep( + id="main", + templateStepId="main", + resourceId=str(uuid.uuid4()), + resourceType=ResourceType.WorkspaceService, + resourceAction=RequestAction.UnInstall, + status=Status.Deleting, + sourceTemplateResourceId=str(workspace_id)) + ]) + resource = create_sample_workspace_object(str(workspace_id)) + resource.properties = {"address_space": "10.1.8.0/24"} + + status_updater = DeploymentStatusUpdater() + status_updater.operations_repo = AsyncMock() + status_updater.operations_repo.get_operation_by_id.return_value = operation + status_updater.resource_repo = AsyncMock() + status_updater.resource_repo.get_resource_by_id.return_value = resource + status_updater.resource_repo.get_resource_dict_by_id.return_value = resource.model_dump() + status_updater.workspace_repo = AsyncMock() + status_updater.resource_template_repo = AsyncMock() + status_updater.resource_history_repo = AsyncMock() + update_resource_for_step.return_value = MagicMock( + id=uuid.uuid4(), + get_resource_request_message_payload=MagicMock(return_value={})) + + message = TypeAdapter(DeploymentStatusUpdateMessage).validate_python({ + **test_sb_message, + "stepId": "workspace-upgrade", + "status": Status.Updated, + }) + + with patch.object(status_updater, "_finalize_workspace_address_space", new_callable=AsyncMock) as finalize: + assert await status_updater.update_status_in_database(message) is True + + finalize.assert_not_awaited() + send_deployment_message.assert_awaited_once() + + async def test_convert_outputs_to_dict(): # Test case 1: Empty list of outputs outputs_list = [] From 4e6df3c6d4ecb36ff97cba8b944480782a12f90a Mon Sep 17 00:00:00 2001 From: James Chapman Date: Fri, 21 Aug 2026 15:31:07 +0000 Subject: [PATCH 35/39] Revert "Remove pending workspace address space tracking" This reverts commit d367fefb68a53db234ee031b4964840e3327abd2. --- api_app/db/repositories/workspaces.py | 1 + .../service_bus/deployment_status_updater.py | 44 +++++++++++++- .../test_workpaces_repository.py | 5 +- .../test_deployment_status_update.py | 57 ------------------- 4 files changed, 47 insertions(+), 60 deletions(-) diff --git a/api_app/db/repositories/workspaces.py b/api_app/db/repositories/workspaces.py index d36788a9be..2592b9681a 100644 --- a/api_app/db/repositories/workspaces.py +++ b/api_app/db/repositories/workspaces.py @@ -199,6 +199,7 @@ async def get_new_address_space(self, cidr_netmask: int = 24): workspaces = await self.get_active_workspaces() networks = [[x.properties.get("address_space")] for x in workspaces] networks = networks + [x.properties.get("address_spaces", []) for x in workspaces] + networks = networks + [x.properties.get("pending_address_spaces", []) for x in workspaces] networks = [i for s in networks for i in s if i is not None] new_address_space = generate_new_cidr(networks, cidr_netmask) diff --git a/api_app/service_bus/deployment_status_updater.py b/api_app/service_bus/deployment_status_updater.py index 2bb16a9e50..4bed196039 100644 --- a/api_app/service_bus/deployment_status_updater.py +++ b/api_app/service_bus/deployment_status_updater.py @@ -165,10 +165,18 @@ async def update_status_in_database(self, message: DeploymentStatusUpdateMessage resource_to_persist = self.create_updated_resource_document(resource, message) await self.resource_repo.update_item_dict(resource_to_persist) + if (step_to_update.resourceType == ResourceType.Workspace + and step_to_update.resourceAction == RequestAction.Upgrade + and operation.action == RequestAction.UnInstall): + if not await self._finalize_pending_workspace_address_space(resource_to_persist, operation): + return False + if (step_to_update.templateStepId == "main" and operation.action == RequestAction.UnInstall and step_to_update.resourceType == ResourceType.WorkspaceService): - if not await self._finalize_workspace_address_space(resource_to_persist, operation): + cleanup_succeeded = await self._finalize_workspace_address_space(resource_to_persist, operation) \ + if is_last_step else await self._mark_workspace_address_space_pending(resource_to_persist, operation) + if not cleanup_succeeded: return False # more steps in the op to do? @@ -213,6 +221,37 @@ async def update_status_in_database(self, message: DeploymentStatusUpdateMessage return result + async def _mark_workspace_address_space_pending(self, resource_to_persist: dict, operation: Operation) -> bool: + address_to_hold = resource_to_persist.get("properties", {}).get("address_space") + parent_workspace_id = resource_to_persist.get("workspaceId") + if not address_to_hold or not parent_workspace_id: + return True + + def update_properties(workspace): + pending_address_spaces = workspace.properties.get("pending_address_spaces", []) + if address_to_hold not in pending_address_spaces: + pending_address_spaces.append(address_to_hold) + return {"pending_address_spaces": pending_address_spaces} + + return await self._patch_workspace_address_spaces(parent_workspace_id, update_properties, operation) + + async def _finalize_pending_workspace_address_space(self, workspace_resource: dict, operation: Operation) -> bool: + main_step = next((step for step in operation.steps if step.templateStepId == "main"), None) + if main_step is None: + return True + + workspace_service = await self.resource_repo.get_resource_dict_by_id(uuid.UUID(main_step.resourceId)) + address_to_free = workspace_service.get("properties", {}).get("address_space") + if not address_to_free: + return True + + def update_properties(workspace): + address_spaces = [address for address in workspace.properties.get("address_spaces", []) if address != address_to_free] + pending_address_spaces = [address for address in workspace.properties.get("pending_address_spaces", []) if address != address_to_free] + return {"address_spaces": address_spaces, "pending_address_spaces": pending_address_spaces} + + return await self._patch_workspace_address_spaces(workspace_resource["id"], update_properties, operation) + async def _finalize_workspace_address_space(self, resource_to_persist: dict, operation: Operation) -> bool: address_to_free = resource_to_persist.get("properties", {}).get("address_space") parent_workspace_id = resource_to_persist.get("workspaceId") @@ -221,7 +260,8 @@ async def _finalize_workspace_address_space(self, resource_to_persist: dict, ope def update_properties(workspace): address_spaces = [address for address in workspace.properties.get("address_spaces", []) if address != address_to_free] - return {"address_spaces": address_spaces} + pending_address_spaces = [address for address in workspace.properties.get("pending_address_spaces", []) if address != address_to_free] + return {"address_spaces": address_spaces, "pending_address_spaces": pending_address_spaces} return await self._patch_workspace_address_spaces(parent_workspace_id, update_properties, operation) diff --git a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py index 114ee64f38..2263b38653 100644 --- a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py +++ b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py @@ -268,7 +268,10 @@ async def test_get_address_space_based_on_size_with_address_space_and_address_sp workspace_with_both.properties["address_spaces"] = ["10.1.7.0/24", "10.1.8.0/24"] workspace_with_both.properties["address_space"] = "10.1.7.0/24" - get_active_workspaces_mock.return_value = [workspace_with_address_space, workspace_with_address_spaces, workspace_with_both] + workspace_with_pending_address_space = copy.deepcopy(workspace) + workspace_with_pending_address_space.properties["pending_address_spaces"] = ["10.1.8.0/24"] + + get_active_workspaces_mock.return_value = [workspace_with_address_space, workspace_with_address_spaces, workspace_with_both, workspace_with_pending_address_space] workspace_to_create = basic_workspace_request address_space = await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) diff --git a/api_app/tests_ma/test_service_bus/test_deployment_status_update.py b/api_app/tests_ma/test_service_bus/test_deployment_status_update.py index d1941777e3..16a63937aa 100644 --- a/api_app/tests_ma/test_service_bus/test_deployment_status_update.py +++ b/api_app/tests_ma/test_service_bus/test_deployment_status_update.py @@ -392,63 +392,6 @@ async def test_multi_step_operation_ends_at_last_step(sb_sender_client, resource sb_sender_client().get_queue_sender().send_messages.assert_not_called() -@patch('service_bus.deployment_status_updater.send_deployment_message') -@patch('service_bus.deployment_status_updater.update_resource_for_step') -async def test_workspace_address_space_is_not_finalized_before_main_uninstall( - update_resource_for_step, send_deployment_message): - workspace_id = uuid.UUID(test_sb_message["id"]) - operation = Operation( - id=OPERATION_ID, - resourceId=str(workspace_id), - resourcePath=f'/workspaces/{workspace_id}', - action=RequestAction.UnInstall, - steps=[ - OperationStep( - id="workspace-upgrade", - templateStepId="workspace-upgrade", - resourceId=str(workspace_id), - resourceType=ResourceType.Workspace, - resourceAction=RequestAction.Upgrade, - status=Status.Updating, - sourceTemplateResourceId=str(workspace_id)), - OperationStep( - id="main", - templateStepId="main", - resourceId=str(uuid.uuid4()), - resourceType=ResourceType.WorkspaceService, - resourceAction=RequestAction.UnInstall, - status=Status.Deleting, - sourceTemplateResourceId=str(workspace_id)) - ]) - resource = create_sample_workspace_object(str(workspace_id)) - resource.properties = {"address_space": "10.1.8.0/24"} - - status_updater = DeploymentStatusUpdater() - status_updater.operations_repo = AsyncMock() - status_updater.operations_repo.get_operation_by_id.return_value = operation - status_updater.resource_repo = AsyncMock() - status_updater.resource_repo.get_resource_by_id.return_value = resource - status_updater.resource_repo.get_resource_dict_by_id.return_value = resource.model_dump() - status_updater.workspace_repo = AsyncMock() - status_updater.resource_template_repo = AsyncMock() - status_updater.resource_history_repo = AsyncMock() - update_resource_for_step.return_value = MagicMock( - id=uuid.uuid4(), - get_resource_request_message_payload=MagicMock(return_value={})) - - message = TypeAdapter(DeploymentStatusUpdateMessage).validate_python({ - **test_sb_message, - "stepId": "workspace-upgrade", - "status": Status.Updated, - }) - - with patch.object(status_updater, "_finalize_workspace_address_space", new_callable=AsyncMock) as finalize: - assert await status_updater.update_status_in_database(message) is True - - finalize.assert_not_awaited() - send_deployment_message.assert_awaited_once() - - async def test_convert_outputs_to_dict(): # Test case 1: Empty list of outputs outputs_list = [] From a6838f69777ef49907051a42a457967bb6c134a1 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Fri, 21 Aug 2026 15:31:07 +0000 Subject: [PATCH 36/39] Revert "Track pending workspace address spaces during service uninstall" This reverts commit 04f4cf4811d5c63d8271facd8cc86f13d9297866. --- api_app/db/repositories/workspaces.py | 1 - .../service_bus/deployment_status_updater.py | 92 ------------------- .../test_workpaces_repository.py | 5 +- 3 files changed, 1 insertion(+), 97 deletions(-) diff --git a/api_app/db/repositories/workspaces.py b/api_app/db/repositories/workspaces.py index 2592b9681a..d36788a9be 100644 --- a/api_app/db/repositories/workspaces.py +++ b/api_app/db/repositories/workspaces.py @@ -199,7 +199,6 @@ async def get_new_address_space(self, cidr_netmask: int = 24): workspaces = await self.get_active_workspaces() networks = [[x.properties.get("address_space")] for x in workspaces] networks = networks + [x.properties.get("address_spaces", []) for x in workspaces] - networks = networks + [x.properties.get("pending_address_spaces", []) for x in workspaces] networks = [i for s in networks for i in s if i is not None] new_address_space = generate_new_cidr(networks, cidr_netmask) diff --git a/api_app/service_bus/deployment_status_updater.py b/api_app/service_bus/deployment_status_updater.py index 4bed196039..702f878892 100644 --- a/api_app/service_bus/deployment_status_updater.py +++ b/api_app/service_bus/deployment_status_updater.py @@ -14,22 +14,15 @@ from azure.servicebus import NEXT_AVAILABLE_SESSION from azure.servicebus.exceptions import OperationTimeoutError, ServiceBusConnectionError from azure.servicebus.aio import ServiceBusClient, AutoLockRenewer -from azure.cosmos.exceptions import CosmosAccessConditionFailedError from db.repositories.operations import OperationRepository -from db.repositories.workspaces import WorkspaceRepository from core import config, credentials from db.errors import EntityDoesNotExist from db.repositories.resources import ResourceRepository from models.domain.operation import DeploymentStatusUpdateMessage, Operation, OperationStep, Status -from models.domain.resource import ResourceType -from models.schemas.resource import ResourcePatch from resources import strings from services.logging import logger, tracer -MAX_CLEANUP_RETRIES = 3 - - class DeploymentStatusUpdater(): def __init__(self): pass @@ -37,7 +30,6 @@ def __init__(self): async def init_repos(self): self.operations_repo = await OperationRepository.create() self.resource_repo = await ResourceRepository.create() - self.workspace_repo = await WorkspaceRepository.create() self.resource_template_repo = await ResourceTemplateRepository.create() self.resource_history_repo = await ResourceHistoryRepository.create() @@ -165,20 +157,6 @@ async def update_status_in_database(self, message: DeploymentStatusUpdateMessage resource_to_persist = self.create_updated_resource_document(resource, message) await self.resource_repo.update_item_dict(resource_to_persist) - if (step_to_update.resourceType == ResourceType.Workspace - and step_to_update.resourceAction == RequestAction.Upgrade - and operation.action == RequestAction.UnInstall): - if not await self._finalize_pending_workspace_address_space(resource_to_persist, operation): - return False - - if (step_to_update.templateStepId == "main" - and operation.action == RequestAction.UnInstall - and step_to_update.resourceType == ResourceType.WorkspaceService): - cleanup_succeeded = await self._finalize_workspace_address_space(resource_to_persist, operation) \ - if is_last_step else await self._mark_workspace_address_space_pending(resource_to_persist, operation) - if not cleanup_succeeded: - return False - # more steps in the op to do? if is_last_step is False: assert current_step_index < (len(operation.steps) - 1) @@ -221,76 +199,6 @@ async def update_status_in_database(self, message: DeploymentStatusUpdateMessage return result - async def _mark_workspace_address_space_pending(self, resource_to_persist: dict, operation: Operation) -> bool: - address_to_hold = resource_to_persist.get("properties", {}).get("address_space") - parent_workspace_id = resource_to_persist.get("workspaceId") - if not address_to_hold or not parent_workspace_id: - return True - - def update_properties(workspace): - pending_address_spaces = workspace.properties.get("pending_address_spaces", []) - if address_to_hold not in pending_address_spaces: - pending_address_spaces.append(address_to_hold) - return {"pending_address_spaces": pending_address_spaces} - - return await self._patch_workspace_address_spaces(parent_workspace_id, update_properties, operation) - - async def _finalize_pending_workspace_address_space(self, workspace_resource: dict, operation: Operation) -> bool: - main_step = next((step for step in operation.steps if step.templateStepId == "main"), None) - if main_step is None: - return True - - workspace_service = await self.resource_repo.get_resource_dict_by_id(uuid.UUID(main_step.resourceId)) - address_to_free = workspace_service.get("properties", {}).get("address_space") - if not address_to_free: - return True - - def update_properties(workspace): - address_spaces = [address for address in workspace.properties.get("address_spaces", []) if address != address_to_free] - pending_address_spaces = [address for address in workspace.properties.get("pending_address_spaces", []) if address != address_to_free] - return {"address_spaces": address_spaces, "pending_address_spaces": pending_address_spaces} - - return await self._patch_workspace_address_spaces(workspace_resource["id"], update_properties, operation) - - async def _finalize_workspace_address_space(self, resource_to_persist: dict, operation: Operation) -> bool: - address_to_free = resource_to_persist.get("properties", {}).get("address_space") - parent_workspace_id = resource_to_persist.get("workspaceId") - if not address_to_free or not parent_workspace_id: - return True - - def update_properties(workspace): - address_spaces = [address for address in workspace.properties.get("address_spaces", []) if address != address_to_free] - pending_address_spaces = [address for address in workspace.properties.get("pending_address_spaces", []) if address != address_to_free] - return {"address_spaces": address_spaces, "pending_address_spaces": pending_address_spaces} - - return await self._patch_workspace_address_spaces(parent_workspace_id, update_properties, operation) - - async def _patch_workspace_address_spaces(self, workspace_id: str, update_properties, operation: Operation) -> bool: - try: - for attempt in range(MAX_CLEANUP_RETRIES): - try: - workspace = await self.workspace_repo.get_workspace_by_id(workspace_id) - workspace_patch = ResourcePatch() - workspace_patch.properties = update_properties(workspace) - await self.workspace_repo.patch_workspace( - workspace, - workspace_patch, - workspace.etag, - self.resource_template_repo, - self.resource_history_repo, - operation.user, - False) - return True - except CosmosAccessConditionFailedError: - if attempt == MAX_CLEANUP_RETRIES - 1: - raise - logger.warning(f"ETag conflict updating workspace address space state. Retrying (attempt {attempt + 1}/{MAX_CLEANUP_RETRIES})...") - except Exception: - logger.exception(f"[ADDRESS_SPACE_CLEANUP_FAILED] Failed to update address space state for workspace {workspace_id}") - return False - - return False - async def update_overall_operation_status(self, operation: Operation, step: OperationStep, is_last_step: bool): operation.updatedWhen = get_timestamp() diff --git a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py index 2263b38653..114ee64f38 100644 --- a/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py +++ b/api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py @@ -268,10 +268,7 @@ async def test_get_address_space_based_on_size_with_address_space_and_address_sp workspace_with_both.properties["address_spaces"] = ["10.1.7.0/24", "10.1.8.0/24"] workspace_with_both.properties["address_space"] = "10.1.7.0/24" - workspace_with_pending_address_space = copy.deepcopy(workspace) - workspace_with_pending_address_space.properties["pending_address_spaces"] = ["10.1.8.0/24"] - - get_active_workspaces_mock.return_value = [workspace_with_address_space, workspace_with_address_spaces, workspace_with_both, workspace_with_pending_address_space] + get_active_workspaces_mock.return_value = [workspace_with_address_space, workspace_with_address_spaces, workspace_with_both] workspace_to_create = basic_workspace_request address_space = await workspace_repo.get_address_space_based_on_size(workspace_to_create.properties) From 0b5bdf2e8b37249c9fc99fc30e843e69b8034a37 Mon Sep 17 00:00:00 2001 From: James Chapman <196318169+JC-wk@users.noreply.github.com> Date: Thu, 1 Oct 2026 11:17:38 +0000 Subject: [PATCH 37/39] bump version --- api_app/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_app/_version.py b/api_app/_version.py index fe75c98b40..df7db86487 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.27.29" +__version__ = "0.28.0" From 275e86064c7bc6aea0fcd600c27f7e62598f7f28 Mon Sep 17 00:00:00 2001 From: James Chapman <196318169+JC-wk@users.noreply.github.com> Date: Thu, 1 Oct 2026 13:04:37 +0000 Subject: [PATCH 38/39] bump versions --- templates/workspaces/airlock-import-review/porter.yaml | 2 +- templates/workspaces/base/porter.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/workspaces/airlock-import-review/porter.yaml b/templates/workspaces/airlock-import-review/porter.yaml index 33c28d20c4..45970c914b 100644 --- a/templates/workspaces/airlock-import-review/porter.yaml +++ b/templates/workspaces/airlock-import-review/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-airlock-import-review -version: 0.17.1 +version: 0.18.0 description: "A workspace to do Airlock Data Import Reviews for Azure TRE" dockerfile: Dockerfile.tmpl registry: azuretre diff --git a/templates/workspaces/base/porter.yaml b/templates/workspaces/base/porter.yaml index 0f2a1d1351..f6aa8dec02 100644 --- a/templates/workspaces/base/porter.yaml +++ b/templates/workspaces/base/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-base -version: 2.11.2 +version: 2.12.0 description: "A base Azure TRE workspace" dockerfile: Dockerfile.tmpl registry: azuretre From 2d9319a730cb79bcad54e54a2aceafcb34651839 Mon Sep 17 00:00:00 2001 From: Jay W <40270505+JayDoubleu@users.noreply.github.com> Date: Tue, 6 Oct 2026 18:01:48 +0100 Subject: [PATCH 39/39] Document CIDR feature component versions in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90088cde45..dfb7fdf945 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ Setting to `false` will delete existing airlock storage accounts and must only be done once all workspaces use the v2 airlock. ([#5048](https://github.com/microsoft/AzureTRE/pull/5048)) ENHANCEMENTS: -* Allow numeric CIDR masks in `address_space_size` (e.g. "23") when requesting auto-assigned address spaces; accepts numeric strings and validates the mask range. ([#4733](https://github.com/microsoft/AzureTRE/issues/4733)) +* Allow numeric CIDR masks in `address_space_size` (e.g. "23") when requesting auto-assigned address spaces; accepts numeric strings and validates the mask range. (`API` 0.28.0, `tre-workspace-base` 2.12.0, `tre-workspace-unrestricted` 0.15.0, `tre-workspace-airlock-import-review` 0.18.0) ([#4733](https://github.com/microsoft/AzureTRE/issues/4733)) * Allow configuring the Certbot executable for `make letsencrypt` with `CERTBOT_BIN`, retaining `/opt/certbot/bin/certbot` as the default (`core` 0.18.10). ([#5067](https://github.com/microsoft/AzureTRE/issues/5067)) * Add a "Your access" panel to the user menu that shows the TRE and workspace roles you hold and do not hold, what each role permits, and a sign out and back in option to pick up role changes, including when a TRE administrator has no workspace role. ([#5051](https://github.com/microsoft/AzureTRE/issues/5051)) * Show a role-appropriate Connect action on resource detail pages, using the same connection behavior as resource cards. ([#5073](https://github.com/microsoft/AzureTRE/issues/5073))