From 1d8a0db52a3342e4b3ab09fa6c3f32ce452d7241 Mon Sep 17 00:00:00 2001 From: Jared Holgate Date: Thu, 16 Nov 2023 12:38:01 +0000 Subject: [PATCH] bug: upstream release version env var (#88) --- src/ALZ.Settings.ps1 | 5 +---- src/ALZ/Private/Build-ALZDeploymentEnvFile.ps1 | 14 +++++++++++--- src/ALZ/Private/New-ALZEnvironmentBicep.ps1 | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/ALZ.Settings.ps1 b/src/ALZ.Settings.ps1 index f945f1b9..93817bff 100644 --- a/src/ALZ.Settings.ps1 +++ b/src/ALZ.Settings.ps1 @@ -1,5 +1,2 @@ # specify the minimum required major PowerShell version that the build script should validate -[version]$script:requiredPSVersion = '5.1.0' - -# specify the supported versions of ALZ-Bicep -$script:ALZBicepSupportedReleases = @('v0.14.0', 'v0.15.0', 'v0.16.0', 'v0.16.1', 'v0.16.2', 'v0.16.3', 'v0.16.4', 'v0.16.5') \ No newline at end of file +[version]$script:requiredPSVersion = '5.1.0' \ No newline at end of file diff --git a/src/ALZ/Private/Build-ALZDeploymentEnvFile.ps1 b/src/ALZ/Private/Build-ALZDeploymentEnvFile.ps1 index 40f5a695..1fffca63 100644 --- a/src/ALZ/Private/Build-ALZDeploymentEnvFile.ps1 +++ b/src/ALZ/Private/Build-ALZDeploymentEnvFile.ps1 @@ -4,7 +4,10 @@ function Build-ALZDeploymentEnvFile { [PSCustomObject] $configuration, [Parameter(Mandatory = $false)] - [string] $destination = "." + [string] $destination = ".", + + [Parameter(Mandatory = $false)] + [string] $version = "" ) <# .SYNOPSIS @@ -24,9 +27,14 @@ function Build-ALZDeploymentEnvFile { foreach ($configurationValue in $configuration.PsObject.Properties) { foreach ($target in $configurationValue.Value.Targets) { if ($target.Destination -eq "Environment") { + Write-InformationColored $configurationValue.Name -ForegroundColor Green -InformationAction Continue - $formattedValue = $configurationValue.Value.Value - Add-Content -Path $envFile -Value "$($($target.Name))=`"$formattedValue`"" | Out-String | Write-Verbose + if($configurationValue.Name -eq "UpstreamReleaseVersion") { + Add-Content -Path $envFile -Value "$($($target.Name))=`"$version`"" | Out-String | Write-Verbose + } else { + $formattedValue = $configurationValue.Value.Value + Add-Content -Path $envFile -Value "$($($target.Name))=`"$formattedValue`"" | Out-String | Write-Verbose + } } } } diff --git a/src/ALZ/Private/New-ALZEnvironmentBicep.ps1 b/src/ALZ/Private/New-ALZEnvironmentBicep.ps1 index 328a3b31..6af7baf0 100644 --- a/src/ALZ/Private/New-ALZEnvironmentBicep.ps1 +++ b/src/ALZ/Private/New-ALZEnvironmentBicep.ps1 @@ -50,7 +50,7 @@ function New-ALZEnvironmentBicep { Set-ComputedConfiguration -configuration $configuration | Out-String | Write-Verbose Edit-ALZConfigurationFilesInPlace -alzEnvironmentDestination $alzEnvironmentDestination -configuration $configuration | Out-String | Write-Verbose - Build-ALZDeploymentEnvFile -configuration $configuration -Destination $alzEnvironmentDestination | Out-String | Write-Verbose + Build-ALZDeploymentEnvFile -configuration $configuration -Destination $alzEnvironmentDestination -version $releaseTag | Out-String | Write-Verbose $isGitRepo = Test-ALZGitRepository -alzEnvironmentDestination $alzEnvironmentDestination if (-not $isGitRepo) {