Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into external_mtastore
Browse files Browse the repository at this point in the history
  • Loading branch information
kosinsky committed Jun 17, 2020
2 parents 5cc15aa + 33aced7 commit 5c1acca
Show file tree
Hide file tree
Showing 965 changed files with 93,582 additions and 10,245 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ website/node_modules
.idea
*.iml
*.test
.terraform.tfstate.lock.info

website/vendor

Expand All @@ -41,5 +42,5 @@ examples/**/test.tfvars
examples/**/terraform
examples/**/terraform.zip

#never upload the build to git
# never upload the build to git
terraform-provider-azurerm
10 changes: 6 additions & 4 deletions .teamcity/components/build_azure.kt
Original file line number Diff line number Diff line change
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
30 changes: 27 additions & 3 deletions .teamcity/components/build_components.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.schedule

// unfortunately TeamCity's Go Test Json parser appears to be broken
// as such for the moment let's use the old method with a feature-flag
const val useTeamCityGoTest = true
const val useTeamCityGoTest = false

fun BuildFeatures.Golang() {
if (useTeamCityGoTest) {
Expand All @@ -25,19 +25,43 @@ fun BuildSteps.ConfigureGoEnv() {
}

fun BuildSteps.RunAcceptanceTests(providerName : String, packageName: String) {
var servicePath = "./%s/internal/services/%s/tests".format(providerName, packageName)

if (useTeamCityGoTest) {
step(ScriptBuildStep {
name = "Run Tests"
scriptContent = "go test -v \"$servicePath\" -timeout=\"%TIMEOUT%h\" -test.parallel=\"%PARALLELISM%\" -run=\"%TEST_PREFIX%\" -json"
})
} else {
step(ScriptBuildStep {
name = "Compile Test Binary"
scriptContent = "go test -c -o test-binary"
workingDir = servicePath
})

step(ScriptBuildStep {
// ./test-binary -test.list=TestAccAzureRMResourceGroup_ | teamcity-go-test -test ./test-binary -timeout 1s
name = "Run via jen20/teamcity-go-test"
scriptContent = "./test-binary -test.list=\"%TEST_PREFIX%\" | teamcity-go-test -test ./test-binary -parallelism \"%PARALLELISM%\" -timeout \"%TIMEOUT%h\""
workingDir = servicePath
})
}
}

fun BuildSteps.RunAcceptanceTestsForPullRequest(providerName : String, packageName: String) {
var servicePath = "./%s/internal/services/%s/...".format(providerName, packageName)
if (useTeamCityGoTest) {
var servicePath = "./%s/internal/services/%s/...".format(providerName, packageName)
step(ScriptBuildStep {
name = "Run Tests"
scriptContent = "go test -v \"$servicePath\" -timeout=\"%TIMEOUT%h\" -test.parallel=\"%PARALLELISM%\" -run=\"%TEST_PREFIX%\" -json"
})
} else {
// Building a binary with teamcity-go-test doesn't work for multiple packages, so fallback to this
step(ScriptBuildStep {
name = "Install tombuildsstuff/teamcity-go-test-json"
scriptContent = "wget https://github.com/tombuildsstuff/teamcity-go-test-json/releases/download/v0.2.0/teamcity-go-test-json_linux_amd64 && chmod +x teamcity-go-test-json_linux_amd64"
})

var servicePath = "./%s/internal/services/%s/...".format(providerName, packageName)
step(ScriptBuildStep {
name = "Run Tests"
scriptContent = "GOFLAGS=\"-mod=vendor\" ./teamcity-go-test-json_linux_amd64 -scope \"$servicePath\" -prefix \"%TEST_PREFIX%\" -count=1 -parallelism=%PARALLELISM% -timeout %TIMEOUT%"
Expand Down
2 changes: 1 addition & 1 deletion .teamcity/components/build_config_pull_request.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class pullRequest(displayName: String, environment: String) {
var packageName = "\"%SERVICES%\""

ConfigureGoEnv()
RunAcceptanceTests(providerName, packageName)
RunAcceptanceTestsForPullRequest(providerName, packageName)
}

failureConditions {
Expand Down
3 changes: 3 additions & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// NOTE: this is Generated from the Service Definitions - manual changes will be lost
// to re-generate this file, run 'make generate' in the root of the repository
var services = mapOf(
"advisor" to "Advisor",
"analysisservices" to "Analysis Services",
"apimanagement" to "API Management",
"appconfiguration" to "App Configuration",
Expand All @@ -9,6 +10,7 @@ var services = mapOf(
"authorization" to "Authorization",
"automation" to "Automation",
"batch" to "Batch",
"blueprints" to "Blueprints",
"bot" to "Bot",
"cdn" to "CDN",
"cognitive" to "Cognitive Services",
Expand Down Expand Up @@ -70,6 +72,7 @@ var services = mapOf(
"storage" to "Storage",
"streamanalytics" to "Stream Analytics",
"subscription" to "Subscription",
"iottimeseriesinsights" to "Time Series Insights",
"trafficmanager" to "Traffic Manager",
"web" to "Web"
)
7 changes: 7 additions & 0 deletions .teamcity/pom.xml
Original file line number Diff line number Diff line change
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
7 changes: 4 additions & 3 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import AzureRM
import ClientConfiguration
import jetbrains.buildServer.configs.kotlin.v2019_2.*

version = "2019.2"
version = "2020.1"

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, tenantId, clientIdAlt, clientSecretAlt, subscriptionIdAlt )

project(AzureRM(environment, clientConfig))
project(AzureRM(environment, clientConfig))
2 changes: 1 addition & 1 deletion .teamcity/tests/helpers.kt
Original file line number Diff line number Diff line change
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", "tenantId", "clientIdAlt", "clientSecretAlt", "subscriptionIdAlt")
}
Loading

0 comments on commit 5c1acca

Please sign in to comment.