AzOps is a PowerShell module which deploys (Push) ARM Resource Templates & Bicep files at all Azure scope levels and exports (Pull) ARM resource hierarchy.
Currently, when AzOps resolves a template file from a parameter file, it uses two replace operations, one of which matches against the regex wildcard character ., rather than the literal character period (\.). Furthermore, by using two separate replace operations, the code misses a series of edge cases.
Consider a template file named templatexabc.xabc.bicep and a valid parameter file templatexabc.xabc.xabc.bicepparam. After performing the two replace operations, we are left with a template file name templat.bicep which doesn't exist.
This PR fixes/adds/changes/removes
Changes how template file names are resolved from parameter files by ensuring that the suffix is matched at most once at the end of the parameter file name.
Breaking Changes
This could theoretically break deployment for someone who relies on the suffix to be matched multiple times in the template path, but I don't think that was ever intended behaviour.
Let me know if this is an issue. I can modify the PR to maintain the two separate replace operations and simply escape the period . in the regular expression to solve the first half of #884. That would be sufficient for my team. Let me also know if we need to change the documentation to make the behaviour of the suffix clearer.
Testing Evidence
I added a test case to src/tests/integration/Repository.Tests.ps1. Haven't been able to run it yet, but I would expect it to work.
Overview/Summary
Proposes to close #884
Currently, when AzOps resolves a template file from a parameter file, it uses two replace operations, one of which matches against the regex wildcard character
.
, rather than the literal character period (\.
). Furthermore, by using two separate replace operations, the code misses a series of edge cases.Consider a template file named
templatexabc.xabc.bicep
and a valid parameter filetemplatexabc.xabc.xabc.bicepparam
. After performing the two replace operations, we are left with a template file nametemplat.bicep
which doesn't exist.This PR fixes/adds/changes/removes
Breaking Changes
Let me know if this is an issue. I can modify the PR to maintain the two separate replace operations and simply escape the period
.
in the regular expression to solve the first half of #884. That would be sufficient for my team. Let me also know if we need to change the documentation to make the behaviour of the suffix clearer.Testing Evidence
I added a test case to
src/tests/integration/Repository.Tests.ps1
. Haven't been able to run it yet, but I would expect it to work.As part of this Pull Request I have
main
branch