diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-ephemeral-resource.kt b/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-ephemeral-resource.kt deleted file mode 100644 index 16b262454858..000000000000 --- a/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-ephemeral-resource.kt +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: MPL-2.0 - */ - -// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. - -package projects.feature_branches - -import ProviderNameBeta -import ProviderNameGa -import SharedResourceNameBeta -import SharedResourceNameGa -import SharedResourceNameVcr -import builds.* -import generated.ServicesListBeta -import generated.ServicesListGa -import jetbrains.buildServer.configs.kotlin.Project -import replaceCharsId -import vcs_roots.HashiCorpVCSRootBeta -import vcs_roots.HashiCorpVCSRootGa -import vcs_roots.ModularMagicianVCSRootBeta -import vcs_roots.ModularMagicianVCSRootGa - -const val featureBranchEphemeralResources = "FEATURE-BRANCH-ephemeral-resource" -const val EphemeralResourcesTfCoreVersion = "1.10.0-rc2" - -// featureBranchEphemeralResourcesSubProject creates a project just for testing ephemeral resources. -// We know that all ephemeral resources we're adding are part of the Resource Manager service, so we only include those builds. -// We create builds for testing the resourcemanager service: -// - Against the GA hashicorp repo -// - Against the GA modular-magician repo -// - Against the Beta hashicorp repo -// - Against the Beta modular-magician repo -// These resemble existing projects present in TeamCity, but these all use a more recent version of Terraform including -// the new ephemeral values feature. -fun featureBranchEphemeralResourcesSubProject(allConfig: AllContextParameters): Project { - - val projectId = replaceCharsId(featureBranchEphemeralResources) - - val packageName = "resourcemanager" // All ephemeral resources will be in the resourcemanager package - val vcrConfig = getVcrAcceptanceTestConfig(allConfig) // Reused below for both MM testing build configs - val trigger = NightlyTriggerConfiguration( - branch = "refs/heads/$featureBranchEphemeralResources" // triggered builds must test the feature branch - ) - - - // GA - val gaConfig = getGaAcceptanceTestConfig(allConfig) - // How to make only build configuration to the relevant package(s) - val resourceManagerPackageGa = ServicesListGa.getValue(packageName) - - // Enable testing using hashicorp/terraform-provider-google - var parentId = "${projectId}_HC_GA" - val buildConfigHashiCorpGa = BuildConfigurationForSinglePackage(packageName, resourceManagerPackageGa.getValue("path"), "Ephemeral resources in $packageName (GA provider, HashiCorp downstream)", ProviderNameGa, parentId, HashiCorpVCSRootGa, listOf(SharedResourceNameGa), gaConfig) - buildConfigHashiCorpGa.addTrigger(trigger) - - // Enable testing using modular-magician/terraform-provider-google - parentId = "${projectId}_MM_GA" - val buildConfigModularMagicianGa = BuildConfigurationForSinglePackage(packageName, resourceManagerPackageGa.getValue("path"), "Ephemeral resources in $packageName (GA provider, MM upstream)", ProviderNameGa, parentId, ModularMagicianVCSRootGa, listOf(SharedResourceNameVcr), vcrConfig) - // No trigger added here (MM upstream is manual only) - - // Beta - val betaConfig = getBetaAcceptanceTestConfig(allConfig) - val resourceManagerPackageBeta = ServicesListBeta.getValue(packageName) - - // Enable testing using hashicorp/terraform-provider-google-beta - parentId = "${projectId}_HC_BETA" - val buildConfigHashiCorpBeta = BuildConfigurationForSinglePackage(packageName, resourceManagerPackageBeta.getValue("path"), "Ephemeral resources in $packageName (Beta provider, HashiCorp downstream)", ProviderNameBeta, parentId, HashiCorpVCSRootBeta, listOf(SharedResourceNameBeta), betaConfig) - buildConfigHashiCorpBeta.addTrigger(trigger) - - // Enable testing using modular-magician/terraform-provider-google-beta - parentId = "${projectId}_MM_BETA" - val buildConfigModularMagicianBeta = BuildConfigurationForSinglePackage(packageName, resourceManagerPackageBeta.getValue("path"), "Ephemeral resources in $packageName (Beta provider, MM upstream)", ProviderNameBeta, parentId, ModularMagicianVCSRootBeta, listOf(SharedResourceNameVcr), vcrConfig) - // No trigger added here (MM upstream is manual only) - - - // ------ - - // Make all builds use a 1.10.0-ish version of TF core - val allBuildConfigs = listOf(buildConfigHashiCorpGa, buildConfigModularMagicianGa, buildConfigHashiCorpBeta, buildConfigModularMagicianBeta) - allBuildConfigs.forEach{ b -> - b.overrideTerraformCoreVersion(EphemeralResourcesTfCoreVersion) - } - - // ------ - - return Project{ - id(projectId) - name = featureBranchEphemeralResources - description = "Subproject for testing feature branch $featureBranchEphemeralResources" - - // Register all build configs in the project - allBuildConfigs.forEach{ b -> - buildType(b) - } - - params { - readOnlySettings() - } - } -} diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/root_project.kt b/mmv1/third_party/terraform/.teamcity/components/projects/root_project.kt index d0a4308a2702..c551f8f20fd2 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/root_project.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/root_project.kt @@ -18,7 +18,6 @@ import generated.ServicesListBeta import generated.ServicesListGa import jetbrains.buildServer.configs.kotlin.Project import jetbrains.buildServer.configs.kotlin.sharedResource -import projects.feature_branches.featureBranchEphemeralResourcesSubProject // googleCloudRootProject returns a root project that contains a subprojects for the GA and Beta version of the // Google provider. There are also resources to help manage the test projects used for acceptance tests. @@ -64,8 +63,6 @@ fun googleCloudRootProject(allConfig: AllContextParameters): Project { subProject(projectSweeperSubProject(allConfig)) // Feature branch-testing projects - these will be added and removed as needed - subProject(featureBranchEphemeralResourcesSubProject(allConfig)) - params { readOnlySettings() diff --git a/mmv1/third_party/terraform/.teamcity/tests/FEATURE-BRANCH-ephemeral-resource.kt b/mmv1/third_party/terraform/.teamcity/tests/FEATURE-BRANCH-ephemeral-resource.kt deleted file mode 100644 index 9b52c2c9d2fe..000000000000 --- a/mmv1/third_party/terraform/.teamcity/tests/FEATURE-BRANCH-ephemeral-resource.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: MPL-2.0 - */ - -// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. - -package tests - -import jetbrains.buildServer.configs.kotlin.triggers.ScheduleTrigger -import org.junit.Assert -import org.junit.Test -import projects.feature_branches.featureBranchEphemeralResources -import projects.googleCloudRootProject - -class FeatureBranchEphemeralResourcesSubProject { - @Test - fun buildsUsingHashiCorpReposAreOnSchedule() { - val root = googleCloudRootProject(testContextParameters()) - - // Find feature branch project - val project = getSubProject(root, featureBranchEphemeralResources) - - // All builds using the HashiCorp owned GitHub repos - val hashiBuilds = project.buildTypes.filter { bt -> - bt.name.contains("HashiCorp downstream") - } - - hashiBuilds.forEach{bt -> - Assert.assertTrue( - "Build configuration `${bt.name}` should contain at least one trigger", - bt.triggers.items.isNotEmpty() - ) - // Look for at least one CRON trigger - var found = false - lateinit var schedulingTrigger: ScheduleTrigger - for (item in bt.triggers.items){ - if (item.type == "schedulingTrigger") { - schedulingTrigger = item as ScheduleTrigger - found = true - break - } - } - - Assert.assertTrue( - "Build configuration `${bt.name}` should contain a CRON/'schedulingTrigger' trigger", - found - ) - - // Check that triggered builds are being run on the feature branch - val isCorrectBranch: Boolean = schedulingTrigger.branchFilter == "+:refs/heads/$featureBranchEphemeralResources" - - Assert.assertTrue( - "Build configuration `${bt.name}` is using the $featureBranchEphemeralResources branch filter", - isCorrectBranch - ) - } - } - - @Test - fun buildsUsingModularMagicianReposAreNotTriggered() { - val root = googleCloudRootProject(testContextParameters()) - - // Find feature branch project - val project = getSubProject(root, featureBranchEphemeralResources) - - // All builds using the HashiCorp owned GitHub repos - val magicianBuilds = project.buildTypes.filter { bt -> - bt.name.contains("MM upstream") - } - - magicianBuilds.forEach{bt -> - Assert.assertTrue( - "Build configuration `${bt.name}` should not have any triggers", - bt.triggers.items.isEmpty() - ) - } - } -}