From e8abc39eaac5edec38b5530e4040ffa891b9212e Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Wed, 5 Apr 2023 14:59:52 -0700 Subject: [PATCH] [test resources] Fix regression - base name overrides in CI (#5924) This PR fixes an issue introduced in https://github.com/Azure/azure-sdk-tools/pull/5242 which stopped respecting BaseName parameter overrides in CI mode. This caused issues in stress deployments where we intentionally override BaseName to get a short name hash and need the value to match up with other places where inject it. CC @richardpark-msft @lmolkova --- eng/common/TestResources/SubConfig-Helpers.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/common/TestResources/SubConfig-Helpers.ps1 b/eng/common/TestResources/SubConfig-Helpers.ps1 index f87b088c3dd..4ef744828b8 100644 --- a/eng/common/TestResources/SubConfig-Helpers.ps1 +++ b/eng/common/TestResources/SubConfig-Helpers.ps1 @@ -23,6 +23,12 @@ function GetBaseAndResourceGroupNames( [string]$serviceDirectoryName, [bool]$CI ) { + if ($baseNameDefault) { + $base = $baseNameDefault.ToLowerInvariant() + $group = $resourceGroupNameDefault ? $resourceGroupNameDefault : ("rg-$baseNameDefault".ToLowerInvariant()) + return $base, $group + } + if ($CI) { $base = 't' + (New-Guid).ToString('n').Substring(0, 16) # Format the resource group name based on resource group naming recommendations and limitations. @@ -37,12 +43,6 @@ function GetBaseAndResourceGroupNames( return $base, $group } - if ($baseNameDefault) { - $base = $baseNameDefault.ToLowerInvariant() - $group = $resourceGroupNameDefault ? $resourceGroupNameDefault : ("rg-$baseNameDefault".ToLowerInvariant()) - return $base, $group - } - # Handle service directories in nested directories, e.g. `data/aztables` $serviceDirectorySafeName = $serviceDirectoryName -replace '[\./\\]', '' # Seed off resource group name if set to avoid name conflicts with deployments where it is not set