Skip to content

Commit

Permalink
bug: upstream release version env var (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredfholgate authored Nov 16, 2023
1 parent 804c131 commit 1d8a0db
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/ALZ.Settings.ps1
Original file line number Diff line number Diff line change
@@ -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')
[version]$script:requiredPSVersion = '5.1.0'
14 changes: 11 additions & 3 deletions src/ALZ/Private/Build-ALZDeploymentEnvFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ function Build-ALZDeploymentEnvFile {
[PSCustomObject] $configuration,

[Parameter(Mandatory = $false)]
[string] $destination = "."
[string] $destination = ".",

[Parameter(Mandatory = $false)]
[string] $version = ""
)
<#
.SYNOPSIS
Expand All @@ -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
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ALZ/Private/New-ALZEnvironmentBicep.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1d8a0db

Please sign in to comment.