Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ BUG FIXES:
* Add timeouts to Graph requests in API ([#4723](https://github.com/microsoft/AzureTRE/issues/4723))
* Fix missing metastoreDomains for Databricks, which caused metastore outages for some domains ([#4779](https://github.com/microsoft/AzureTRE/issues/4779))
* Fix cost display duplication when user resource is deleted - UI incorrectly reused cost data for remaining resources ([#4783](https://github.com/microsoft/AzureTRE/issues/4783))
* Fix type mismatch error where `{{ resource.parent.my_boolean_property }}` was returning string instead of the correct type ([#4813](https://github.com/microsoft/AzureTRE/issues/4813))
* Delete npm package lock file ([#4810](https://github.com/microsoft/AzureTRE/issues/4810))

COMPONENTS:
Expand Down
2 changes: 1 addition & 1 deletion api_app/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.25.12"
__version__ = "0.25.13"
2 changes: 2 additions & 0 deletions api_app/service_bus/substitutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ def substitute_value(val: str, primary_resource_dict: dict, primary_parent_ws_di
if isinstance(prop_to_get, dict) or isinstance(prop_to_get, list):
return prop_to_get
else:
if val == "{{" + t + "}}":
return prop_to_get
val = val.replace("{{" + t + "}}", str(prop_to_get))

return val
25 changes: 25 additions & 0 deletions api_app/tests_ma/test_service_bus/test_substitutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,28 @@ def test_substitution_array_replace_not_found(
obj = substitute_properties(step, primary_resource, None, None, resource_to_update)
assert len(obj["rule_collections"]) == 1
assert obj["rule_collections"][0]["name"] == "Object 1"


def test_substitution_boolean_preservation(primary_resource):
resource_dict = primary_resource.dict()
# Mock a boolean property in the resource dict
resource_dict["properties"]["isEnabled"] = True
resource_dict["properties"]["count"] = 42

# Test boolean preservation
val_to_sub = "{{ resource.properties.isEnabled }}"
val = substitute_value(val_to_sub, resource_dict, None, None)
assert val is True
assert isinstance(val, bool)

# Test int preservation
val_to_sub = "{{ resource.properties.count }}"
val = substitute_value(val_to_sub, resource_dict, None, None)
assert val == 42
assert isinstance(val, int)

# Test string concatenation (should fallback to string)
val_to_sub = "Count is {{ resource.properties.count }}"
val = substitute_value(val_to_sub, resource_dict, None, None)
assert val == "Count is 42"
assert isinstance(val, str)
11 changes: 11 additions & 0 deletions docs/tre-templates/pipeline-templates/pipeline-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ It's possible to refer to properties from the primary resource (the resource tha

The syntax is `{{ resource.propertyName }}`. For example: `"{{ resource.properties.display_name }}"`.

### Accessing Parent Resource Properties
It's also possible to access properties from the parent resources. This is useful when a resource needs information from its container (e.g. a user resource needing the workspace service's address space).

| Resource Type | Available References | Description |
| --- | --- | --- |
| User Resource | `{{ resource.parent.properties... }}` | Properties of the **Workspace Service** |
| User Resource | `{{ resource.parent.parent.properties... }}` | Properties of the **Workspace** |
| Workspace Service | `{{ resource.parent.properties... }}` | Properties of the **Workspace** |
| Workspace | N/A | Workspaces do not have parents in this context |
| Shared Service | N/A | Shared Services do not have parents in this context |

Example pipeline in `template_schema.json`:
The below example references 2 properties from the primary resource to be used in updating the firewall shared service.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ All the values for the required parameters will be provided by the deployment ru

Any **custom parameters** are picked up by Azure TRE API and will be queried from the user deploying the workspace bundle. Custom parameters should also be defined in the `template_schema.json` file at the root of the bundle. This file follows the [JSON schema standard](http://json-schema.org/) and can be used by a user interface to generate a UI for the user to input the parameters.

### Template properties

When authoring a `template_schema.json` file, you can reference properties from the resource being deployed, or its parent resources. For more information see [Pipeline Template Schema](../tre-templates/pipeline-templates/pipeline-schema.md#substituting-resource-property-values).

### Output

!!! todo
Expand Down Expand Up @@ -109,7 +113,7 @@ The size of the `address_space` will default to `/24`, however other sizes can b

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.

In your install pipeline you also need to include a workspace upgrade step for the workspace to update it's `address_spaces` property.
In your install and uninstall pipelines you also need to include a workspace upgrade step for the workspace to update it's `address_spaces` property.

```json
"pipeline": {
Expand Down
Loading