Correctly resolve template file from parameter files when suffix appears multiple times in path #885
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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