Skip to content

Commit

Permalink
Merge pull request #6978 from terraform-providers/ci/additional-subsc…
Browse files Browse the repository at this point in the history
…ription

Added alt subscription to tc config
  • Loading branch information
tombuildsstuff committed May 18, 2020
2 parents 7e0b868 + 1885773 commit e77174e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
10 changes: 6 additions & 4 deletions .teamcity/components/build_azure.kt
Expand Up @@ -4,21 +4,23 @@ class ClientConfiguration(var clientId: String,
var clientSecret: String,
val subscriptionId : String,
val tenantId : String,
val altClientId: String,
val altClientSecret: String) {
val clientIdAlt: String,
val clientSecretAlt: String,
val subscriptionIdAlt : String) {
}

class LocationConfiguration(var primary : String, var secondary : String, var ternary : String, var rotate : Boolean) {
}

fun ParametrizedWithType.ConfigureAzureSpecificTestParameters(environment: String, config: ClientConfiguration, locationsForEnv: LocationConfiguration) {
hiddenPasswordVariable("env.ARM_CLIENT_ID", config.clientId, "The ID of the Service Principal used for Testing")
hiddenPasswordVariable("env.ARM_CLIENT_ID_ALT", config.altClientId, "The ID of the Alternate 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.altClientSecret, "The Client Secret of the Alternate 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")
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")
Expand Down
7 changes: 7 additions & 0 deletions .teamcity/pom.xml
Expand Up @@ -20,6 +20,13 @@
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>teamcity-server</id>
<url>https://teamcity.jetbrains.com/app/dsl-plugins-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<pluginRepositories>
Expand Down
3 changes: 2 additions & 1 deletion .teamcity/settings.kts
Expand Up @@ -7,11 +7,12 @@ version = "2019.2"
var clientId = DslContext.getParameter("clientId", "")
var clientSecret = DslContext.getParameter("clientSecret", "")
var subscriptionId = DslContext.getParameter("subscriptionId", "")
var subscriptionIdAlt = DslContext.getParameter("subscriptionIdAlt", "")
var tenantId = DslContext.getParameter("tenantId", "")
var environment = DslContext.getParameter("environment", "public")
var clientIdAlt = DslContext.getParameter("clientIdAlt", "")
var clientSecretAlt = DslContext.getParameter("clientSecretAlt", "")

var clientConfig = ClientConfiguration(clientId, clientSecret, subscriptionId, tenantId, clientIdAlt, clientSecretAlt)
var clientConfig = ClientConfiguration(clientId, clientSecret, subscriptionId, subscriptionIdAlt, tenantId, clientIdAlt, clientSecretAlt)

project(AzureRM(environment, clientConfig))
2 changes: 1 addition & 1 deletion .teamcity/tests/helpers.kt
Expand Up @@ -3,5 +3,5 @@ package tests
import ClientConfiguration

fun TestConfiguration() : ClientConfiguration {
return ClientConfiguration("clientId", "clientSecret", "subscriptionId", "tenantId", "altClientId", "altClientSecret")
return ClientConfiguration("clientId", "clientSecret", "subscriptionId", "subscriptionIdAlt", "tenantId", "clientIdAlt", "clientSecretAlt")
}

0 comments on commit e77174e

Please sign in to comment.