From bb3ddf020d6de2c43ea1c1537e702a263674e06a Mon Sep 17 00:00:00 2001 From: jackofallops <11830746+jackofallops@users.noreply.github.com> Date: Mon, 21 Mar 2022 07:37:44 +0000 Subject: [PATCH] CI - enable acctest distribution across subscriptions and enable location rotation (#15826) --- .teamcity/components/build_azure.kt | 15 ++++++++++----- .teamcity/components/project.kt | 5 +++-- .teamcity/components/settings.kt | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.teamcity/components/build_azure.kt b/.teamcity/components/build_azure.kt index b8a401e4204f..f516bc93200f 100644 --- a/.teamcity/components/build_azure.kt +++ b/.teamcity/components/build_azure.kt @@ -12,18 +12,23 @@ class ClientConfiguration(var clientId: String, class LocationConfiguration(var primary : String, var secondary : String, var ternary : String, var rotate : Boolean) { } -fun ParametrizedWithType.ConfigureAzureSpecificTestParameters(environment: String, config: ClientConfiguration, locationsForEnv: LocationConfiguration) { +fun ParametrizedWithType.ConfigureAzureSpecificTestParameters(environment: String, config: ClientConfiguration, locationsForEnv: LocationConfiguration, useAltSubscription: Boolean = false) { hiddenPasswordVariable("env.ARM_CLIENT_ID", config.clientId, "The ID of the Service Principal used for Testing") hiddenPasswordVariable("env.ARM_CLIENT_ID_ALT", config.clientIdAlt, "The ID of the Alternate Service Principal used for Testing") hiddenPasswordVariable("env.ARM_CLIENT_SECRET", config.clientSecret, "The Client Secret of the Service Principal used for Testing") hiddenPasswordVariable("env.ARM_CLIENT_SECRET_ALT", config.clientSecretAlt, "The Client Secret of the Alternate Service Principal used for Testing") hiddenVariable("env.ARM_ENVIRONMENT", environment, "The Azure Environment in which the tests are running") hiddenVariable("env.ARM_PROVIDER_DYNAMIC_TEST", "%b".format(locationsForEnv.rotate), "Should tests rotate between the supported regions?") - hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID", config.subscriptionId, "The ID of the Azure Subscription used for Testing") - hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID_ALT", config.subscriptionIdAlt, "The ID of the Alternate Azure Subscription used for Testing") + if (useAltSubscription) { + hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID", config.subscriptionIdAlt, "The ID of the Azure Subscription used for Testing (swapped)") + hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID_ALT", config.subscriptionId, "The ID of the Alternate Azure Subscription used for Testing (swapped)") + } else { + hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID", config.subscriptionId, "The ID of the Azure Subscription used for Testing") + hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID_ALT", config.subscriptionIdAlt, "The ID of the Alternate Azure Subscription used for Testing") + } hiddenPasswordVariable("env.ARM_TENANT_ID", config.tenantId, "The ID of the Azure Tenant used for Testing") hiddenVariable("env.ARM_TEST_LOCATION", locationsForEnv.primary, "The Primary region which should be used for testing") - hiddenVariable("env.ARM_TEST_LOCATION_ALT", locationsForEnv.secondary, "The Primary region which should be used for testing") - hiddenVariable("env.ARM_TEST_LOCATION_ALT2", locationsForEnv.ternary, "The Primary region which should be used for testing") + hiddenVariable("env.ARM_TEST_LOCATION_ALT", locationsForEnv.secondary, "The Secondary region which should be used for testing") + hiddenVariable("env.ARM_TEST_LOCATION_ALT2", locationsForEnv.ternary, "The Tertiary region which should be used for testing") hiddenVariable("env.ARM_THREEPOINTZERO_BETA", "true", "Opt into the use of 3.0 beta resources") } \ No newline at end of file diff --git a/.teamcity/components/project.kt b/.teamcity/components/project.kt index ee052834a376..7965714e49f2 100644 --- a/.teamcity/components/project.kt +++ b/.teamcity/components/project.kt @@ -30,7 +30,7 @@ fun buildConfigurationsForServices(services: Map, providerName : var service = serviceDetails(serviceName, displayName, environment) var buildConfig = service.buildConfiguration(providerName, runNightly, testConfig.startHour, testConfig.parallelism, testConfig.daysOfWeek, testConfig.daysOfMonth) - buildConfig.params.ConfigureAzureSpecificTestParameters(environment, config, locationsForEnv) + buildConfig.params.ConfigureAzureSpecificTestParameters(environment, config, locationsForEnv, testConfig.useAltSubscription) list.add(buildConfig) } @@ -46,9 +46,10 @@ fun pullRequestBuildConfiguration(environment: String, configuration: ClientConf return buildConfiguration } -class testConfiguration(parallelism: Int = defaultParallelism, startHour: Int = defaultStartHour, daysOfWeek: String = defaultDaysOfWeek, daysOfMonth: String = defaultDaysOfMonth) { +class testConfiguration(parallelism: Int = defaultParallelism, startHour: Int = defaultStartHour, daysOfWeek: String = defaultDaysOfWeek, daysOfMonth: String = defaultDaysOfMonth, useAltSubscription: Boolean = false) { var parallelism = parallelism var startHour = startHour var daysOfWeek = daysOfWeek var daysOfMonth = daysOfMonth + var useAltSubscription = useAltSubscription } \ No newline at end of file diff --git a/.teamcity/components/settings.kt b/.teamcity/components/settings.kt index 4d301a23a4c0..45ec5dc2658e 100644 --- a/.teamcity/components/settings.kt +++ b/.teamcity/components/settings.kt @@ -14,7 +14,7 @@ const val defaultDaysOfWeek = "2,3,4,5,6" const val defaultDaysOfMonth = "*" var locations = mapOf( - "public" to LocationConfiguration("westeurope", "eastus2", "francecentral", false) + "public" to LocationConfiguration("westeurope", "eastus2", "westus", true) ) // specifies the list of Azure Environments where tests should be run nightly