Skip to content

Commit

Permalink
Set resource group env variable early so remove always works (#23594)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
  • Loading branch information
azure-sdk and benbp authored Oct 16, 2024
1 parent 1e3b3f1 commit 07c1fcb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eng/common/TestResources/New-TestResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ try {
# to determine whether resources should be removed.
Write-Host "Setting variable 'CI_HAS_DEPLOYED_RESOURCES': 'true'"
LogVsoCommand "##vso[task.setvariable variable=CI_HAS_DEPLOYED_RESOURCES;]true"
# Set resource group env variable early in cases where deployment fails as we
# still want to clean up the group. The Remove-TestResources.ps1 script consumes this var.
$envVarName = (BuildServiceDirectoryPrefix $serviceName) + "RESOURCE_GROUP"
LogVsoCommand "##vso[task.setvariable variable=$envVarName;]$ResourceGroupName"
}

Log "Creating resource group '$ResourceGroupName' in location '$Location'"
Expand Down

0 comments on commit 07c1fcb

Please # to comment.