Skip to content

Commit

Permalink
addon
Browse files Browse the repository at this point in the history
  • Loading branch information
Jefajers committed Jun 5, 2024
1 parent ded04c4 commit 0013833
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/functions/Invoke-AzOpsPush.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@
$bicepTemplatePath = $fileItem.FullName -replace "\.$($fileItem.FullName.Split('.')[-3])\.parameters.json$", '.bicep'
}
else {
$templatePath = $fileItem.FullName -replace '\.parameters.json', (Get-PSFConfigValue -FullName 'AzOps.Core.TemplateParameterFileSuffix')
$bicepTemplatePath = $fileItem.FullName -replace '.parameters.json', '.bicep'
$templatePath = $fileItem.FullName -replace '\.parameters.json$', (Get-PSFConfigValue -FullName 'AzOps.Core.TemplateParameterFileSuffix')
$bicepTemplatePath = $fileItem.FullName -replace '\.parameters.json$', '.bicep'
}
if (Test-Path $templatePath) {
if ($CompareDeploymentToDeletion) {
Expand Down Expand Up @@ -213,7 +213,7 @@
$bicepTemplatePath = $fileItem.FullName -replace "\.$($fileItem.FullName.Split('.')[-2])\.bicepparam$", '.bicep'
}
else {
$bicepTemplatePath = $fileItem.FullName -replace '\.bicepparam', '.bicep'
$bicepTemplatePath = $fileItem.FullName -replace '\.bicepparam$', '.bicep'
}
if (Test-Path $bicepTemplatePath) {
if ($CompareDeploymentToDeletion) {
Expand Down
6 changes: 3 additions & 3 deletions src/internal/functions/ConvertFrom-AzOpsBicepTemplate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
continue
}
}
$transpiledTemplatePath = [IO.Path]::GetFullPath("$($BicepTemplatePath -replace '\.bicep', '.json')")
$transpiledTemplatePath = [IO.Path]::GetFullPath("$($BicepTemplatePath -replace '\.bicep$', '.json')")
if ($transpiledTemplatePath -notin $ConvertedTemplate) {
# Convert bicep template
Write-AzOpsMessage -LogLevel Debug -LogString 'ConvertFrom-AzOpsBicepTemplate.Resolve.ConvertBicepTemplate' -LogStringValues $BicepTemplatePath, $transpiledTemplatePath
Expand All @@ -69,7 +69,7 @@
if (-not $SkipParam) {
if (-not $BicepParamTemplatePath) {
# Check if bicep template has associated bicepparam file
$bicepParametersPath = $BicepTemplatePath -replace '\.bicep', '.bicepparam'
$bicepParametersPath = $BicepTemplatePath -replace '\.bicep$', '.bicepparam'
Write-AzOpsMessage -LogLevel Debug -LogString 'ConvertFrom-AzOpsBicepTemplate.Resolve.BicepParam' -LogStringValues $BicepTemplatePath, $bicepParametersPath
}
elseif ($BicepParamTemplatePath) {
Expand All @@ -85,7 +85,7 @@
}
}
if (-not $skipParameters -and $bicepParametersPath -and (Test-Path $bicepParametersPath)) {
$transpiledParametersPath = [IO.Path]::GetFullPath("$($bicepParametersPath -replace '\.bicepparam', '.parameters.json')")
$transpiledParametersPath = [IO.Path]::GetFullPath("$($bicepParametersPath -replace '\.bicepparam$', '.parameters.json')")
if ($transpiledParametersPath -notin $ConvertedParameter) {
# Convert bicepparam to ARM parameter file
Write-AzOpsMessage -LogLevel Debug -LogString 'ConvertFrom-AzOpsBicepTemplate.Resolve.ConvertBicepParam' -LogStringValues $bicepParametersPath, $transpiledParametersPath
Expand Down
3 changes: 2 additions & 1 deletion src/tests/integration/Repository.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ Describe "Repository" {
#region Bicep multiple parameter files with change, suffix appears multiple times in the path of the associated template
It "Deploy Bicep base template with parameter files where suffix appears multiple times in path" {
Set-PSFConfig -FullName AzOps.Core.AllowMultipleTemplateParameterFiles -Value $true
Set-PSFConfig -FullName AzOps.Core.MultipleTemplateParameterFileSuffix -Value ".\\w+"
Set-PSFConfig -FullName AzOps.Core.MultipleTemplateParameterFileSuffix -Value ".\w+"
$script:bicepRepeatSuffixPath = Get-ChildItem -Path "$($global:testRoot)/templates/rtsuffix0102*" | Copy-Item -Destination $script:resourceGroupDirectory -PassThru -Force
$changeSet = @(
"A`t$($script:bicepRepeatSuffixPath.FullName[0])",
Expand All @@ -1180,6 +1180,7 @@ Describe "Repository" {
Start-Sleep -Seconds 5
$script:bicepRepeatSuffixPathDeployment = Get-AzResource -ResourceGroupName $($script:resourceGroup).ResourceGroupName -ResourceType 'Microsoft.Network/routeTables' | Where-Object {$_.name -like "rtsuffix*"}
$script:bicepRepeatSuffixPathDeployment.Count | Should -Be 2
Set-PSFConfig -FullName AzOps.Core.MultipleTemplateParameterFileSuffix -Value ".x"
}
#endregion

Expand Down

0 comments on commit 0013833

Please sign in to comment.