From 1811e94e4a4c9a90caa059ab4af1f0892dceaef9 Mon Sep 17 00:00:00 2001 From: Sarah French Date: Wed, 3 Jul 2024 15:41:37 +0100 Subject: [PATCH 01/11] Add ability to make copies of a `NightlyTriggerConfiguration`, allow overwriting some fields --- .../components/builds/build_triggers.kt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mmv1/third_party/terraform/.teamcity/components/builds/build_triggers.kt b/mmv1/third_party/terraform/.teamcity/components/builds/build_triggers.kt index 14628a112b21..7b4576d92390 100644 --- a/mmv1/third_party/terraform/.teamcity/components/builds/build_triggers.kt +++ b/mmv1/third_party/terraform/.teamcity/components/builds/build_triggers.kt @@ -18,10 +18,20 @@ import jetbrains.buildServer.configs.kotlin.triggers.schedule class NightlyTriggerConfiguration( val branch: String = DefaultBranchName, val nightlyTestsEnabled: Boolean = true, - val startHour: Int = DefaultStartHour, - val daysOfWeek: String = DefaultDaysOfWeek, + var startHour: Int = DefaultStartHour, + var daysOfWeek: String = DefaultDaysOfWeek, val daysOfMonth: String = DefaultDaysOfMonth -) +){ + public fun clone(): NightlyTriggerConfiguration{ + return NightlyTriggerConfiguration( + this.branch, + this.nightlyTestsEnabled, + this.startHour, + this.daysOfWeek, + this.daysOfMonth + ) + } +}) fun Triggers.runNightly(config: NightlyTriggerConfiguration) { From bcb38123114e35e5b23fd1a836eb93c3d3289171 Mon Sep 17 00:00:00 2001 From: Sarah French Date: Wed, 3 Jul 2024 16:02:18 +0100 Subject: [PATCH 02/11] Make the nightly test project's service sweepers crons relative to when the acc test builds are triggered --- .../.teamcity/components/projects/reused/nightly_tests.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/reused/nightly_tests.kt b/mmv1/third_party/terraform/.teamcity/components/projects/reused/nightly_tests.kt index 75fd33a9d529..52fd6d05f357 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/reused/nightly_tests.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/reused/nightly_tests.kt @@ -51,8 +51,9 @@ fun nightlyTests(parentProject:String, providerName: String, vcsRoot: GitVcsRoot else -> throw Exception("Provider name not supplied when generating a nightly test subproject") } val serviceSweeperConfig = BuildConfigurationForServiceSweeper(providerName, ServiceSweeperName, sweepersList, projectId, vcsRoot, sharedResources, config) - val sweeperTrigger = NightlyTriggerConfiguration(startHour=11) // Override hour - serviceSweeperConfig.addTrigger(sweeperTrigger) + val sweeperCron = accTestTrigger.clone() + sweeperCron.startHour += 5 // Ensure triggered after the package test builds are triggered + serviceSweeperConfig.addTrigger(sweeperCron) return Project { id(projectId) From 2ab46dc1abb478a1575d64cc611d5235e71e99fd Mon Sep 17 00:00:00 2001 From: Sarah French Date: Wed, 3 Jul 2024 16:02:54 +0100 Subject: [PATCH 03/11] Edits recommended by IDE --- .../components/projects/google_beta_subproject.kt | 7 ++----- .../.teamcity/components/projects/google_ga_subproject.kt | 7 ++----- .../components/projects/project_sweeper_project.kt | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt b/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt index 6b6e694f1866..f3a78965970d 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt @@ -8,10 +8,7 @@ package projects import ProviderNameBeta -import builds.AllContextParameters -import builds.getBetaAcceptanceTestConfig -import builds.getVcrAcceptanceTestConfig -import builds.readOnlySettings +import builds.* import jetbrains.buildServer.configs.kotlin.Project import projects.reused.mmUpstream import projects.reused.nightlyTests @@ -23,7 +20,7 @@ import vcs_roots.ModularMagicianVCSRootBeta // googleSubProjectBeta returns a subproject that is used for testing terraform-provider-google-beta (Beta) fun googleSubProjectBeta(allConfig: AllContextParameters): Project { - var betaId = replaceCharsId("GOOGLE_BETA") + val betaId = replaceCharsId("GOOGLE_BETA") // Get config for using the Beta and VCR identities val betaConfig = getBetaAcceptanceTestConfig(allConfig) diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt b/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt index 0f0605766ea6..eb04fe261e4b 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt @@ -8,10 +8,7 @@ package projects import ProviderNameGa -import builds.AllContextParameters -import builds.getGaAcceptanceTestConfig -import builds.getVcrAcceptanceTestConfig -import builds.readOnlySettings +import builds.* import jetbrains.buildServer.configs.kotlin.Project import projects.reused.mmUpstream import projects.reused.nightlyTests @@ -22,7 +19,7 @@ import vcs_roots.ModularMagicianVCSRootGa // googleSubProjectGa returns a subproject that is used for testing terraform-provider-google (GA) fun googleSubProjectGa(allConfig: AllContextParameters): Project { - var gaId = replaceCharsId("GOOGLE") + val gaId = replaceCharsId("GOOGLE") // Get config for using the GA and VCR identities val gaConfig = getGaAcceptanceTestConfig(allConfig) diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/project_sweeper_project.kt b/mmv1/third_party/terraform/.teamcity/components/projects/project_sweeper_project.kt index 2a484f583f9b..1d54e841d015 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/project_sweeper_project.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/project_sweeper_project.kt @@ -23,7 +23,7 @@ fun projectSweeperSubProject(allConfig: AllContextParameters): Project { val projectId = replaceCharsId("PROJECT_SWEEPER") - // Get config for using the GA identity (arbitrary choice as sweeper isn't confined by GA/Beta etc) + // Get config for using the GA identity (arbitrary choice as sweeper isn't confined by GA/Beta etc.) val gaConfig = getGaAcceptanceTestConfig(allConfig) // List of ALL shared resources; avoid clashing with any other running build From 2844bfd2aa5fb59db0c77638e5f97a3e500f4d57 Mon Sep 17 00:00:00 2001 From: Sarah French Date: Wed, 3 Jul 2024 16:03:42 +0100 Subject: [PATCH 04/11] Fix test so that ints are compared as ints instead of as strings --- mmv1/third_party/terraform/.teamcity/tests/sweepers.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/.teamcity/tests/sweepers.kt b/mmv1/third_party/terraform/.teamcity/tests/sweepers.kt index 727675e09731..f6babaa4807a 100644 --- a/mmv1/third_party/terraform/.teamcity/tests/sweepers.kt +++ b/mmv1/third_party/terraform/.teamcity/tests/sweepers.kt @@ -151,7 +151,7 @@ class SweeperTests { val cronBeta = stBeta.schedulingPolicy as ScheduleTrigger.SchedulingPolicy.Cron val stProject = projectSweeper.triggers.items[0] as ScheduleTrigger val cronProject = stProject.schedulingPolicy as ScheduleTrigger.SchedulingPolicy.Cron - assertTrue("Service sweeper for the GA Nightly Test project should be triggered at an earlier hour than the project sweeper", cronGa.hours.toString() < cronProject.hours.toString()) // Values are strings like "11", "12" - assertTrue("Service sweeper for the Beta Nightly Test project should be triggered at an earlier hour than the project sweeper", cronBeta.hours.toString() < cronProject.hours.toString() ) + assertTrue("Service sweeper for the GA Nightly Test project should be triggered at an earlier hour than the project sweeper", cronGa.hours.toString().toInt() < cronProject.hours.toString().toInt()) // Converting nullable strings to ints + assertTrue("Service sweeper for the Beta Nightly Test project should be triggered at an earlier hour than the project sweeper", cronBeta.hours.toString().toInt() < cronProject.hours.toString().toInt() ) } } From d6b05b869790d1f9bfa038e23b2a50c5ab4140be Mon Sep 17 00:00:00 2001 From: Sarah French Date: Wed, 3 Jul 2024 16:29:00 +0100 Subject: [PATCH 05/11] Update reused nightly and upstream testing code to receive CRON config as an argument --- .../components/projects/google_beta_subproject.kt | 5 +++-- .../.teamcity/components/projects/google_ga_subproject.kt | 4 ++-- .../.teamcity/components/projects/reused/mm_upstream.kt | 8 +++++--- .../.teamcity/components/projects/reused/nightly_tests.kt | 8 ++++---- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt b/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt index f3a78965970d..3c4988e043e2 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt @@ -32,10 +32,11 @@ fun googleSubProjectBeta(allConfig: AllContextParameters): Project { description = "Subproject containing builds for testing the Beta version of the Google provider" // Nightly Test project that uses hashicorp/terraform-provider-google-beta - subProject(nightlyTests(betaId, ProviderNameBeta, HashiCorpVCSRootBeta, betaConfig)) + subProject(nightlyTests(betaId, ProviderNameBeta, HashiCorpVCSRootBeta, betaConfig, NightlyTriggerConfiguration())) + // MM Upstream project that uses modular-magician/terraform-provider-google-beta - subProject(mmUpstream(betaId, ProviderNameBeta, ModularMagicianVCSRootBeta, HashiCorpVCSRootBeta, vcrConfig)) + subProject(mmUpstream(betaId, ProviderNameBeta, ModularMagicianVCSRootBeta, HashiCorpVCSRootBeta, vcrConfig, NightlyTriggerConfiguration())) // VCR recording project that allows VCR recordings to be made using hashicorp/terraform-provider-google-beta OR modular-magician/terraform-provider-google-beta // This is only present for the Beta provider, as only TPGB VCR recordings are used. diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt b/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt index eb04fe261e4b..cd45d7d754c8 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt @@ -31,10 +31,10 @@ fun googleSubProjectGa(allConfig: AllContextParameters): Project { description = "Subproject containing builds for testing the GA version of the Google provider" // Nightly Test project that uses hashicorp/terraform-provider-google - subProject(nightlyTests(gaId, ProviderNameGa, HashiCorpVCSRootGa, gaConfig)) + subProject(nightlyTests(gaId, ProviderNameGa, HashiCorpVCSRootGa, gaConfig, NightlyTriggerConfiguration())) // MM Upstream project that uses modular-magician/terraform-provider-google - subProject(mmUpstream(gaId, ProviderNameGa, ModularMagicianVCSRootGa, HashiCorpVCSRootGa, vcrConfig)) + subProject(mmUpstream(gaId, ProviderNameGa, ModularMagicianVCSRootGa, HashiCorpVCSRootGa, vcrConfig, NightlyTriggerConfiguration())) params { readOnlySettings() diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/reused/mm_upstream.kt b/mmv1/third_party/terraform/.teamcity/components/projects/reused/mm_upstream.kt index 83efcf91f109..9492fed89368 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/reused/mm_upstream.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/reused/mm_upstream.kt @@ -25,7 +25,7 @@ import jetbrains.buildServer.configs.kotlin.Project import jetbrains.buildServer.configs.kotlin.vcs.GitVcsRoot import replaceCharsId -fun mmUpstream(parentProject: String, providerName: String, vcsRoot: GitVcsRoot, cronSweeperVcsRoot: GitVcsRoot, config: AccTestConfiguration): Project { +fun mmUpstream(parentProject: String, providerName: String, vcsRoot: GitVcsRoot, cronSweeperVcsRoot: GitVcsRoot, config: AccTestConfiguration, cron: NightlyTriggerConfiguration): Project { // Create unique ID for the dynamically-created project var projectId = "${parentProject}_${MMUpstreamProjectId}" @@ -45,11 +45,13 @@ fun mmUpstream(parentProject: String, providerName: String, vcsRoot: GitVcsRoot, ProviderNameBeta -> sweepersList = SweepersListBeta else -> throw Exception("Provider name not supplied when generating a nightly test subproject") } + + // This build is for manually-initialed runs of sweepers, to test changes to sweepers from the upstream repo val serviceSweeperManualConfig = BuildConfigurationForServiceSweeper(providerName, ServiceSweeperManualName, sweepersList, projectId, vcsRoot, sharedResources, config) + // This build runs on a schedule to do actual sweeping of the VCR project, using the downstream repo's code val serviceSweeperCronConfig = BuildConfigurationForServiceSweeper(providerName, ServiceSweeperCronName, sweepersList, projectId, cronSweeperVcsRoot, sharedResources, config) - val trigger = NightlyTriggerConfiguration(startHour=12) - serviceSweeperCronConfig.addTrigger(trigger) // Only the sweeper is on a schedule in this project + serviceSweeperCronConfig.addTrigger(cron) return Project { id(projectId) diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/reused/nightly_tests.kt b/mmv1/third_party/terraform/.teamcity/components/projects/reused/nightly_tests.kt index 52fd6d05f357..90fa2d49947d 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/reused/nightly_tests.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/reused/nightly_tests.kt @@ -20,7 +20,7 @@ import jetbrains.buildServer.configs.kotlin.Project import jetbrains.buildServer.configs.kotlin.vcs.GitVcsRoot import replaceCharsId -fun nightlyTests(parentProject:String, providerName: String, vcsRoot: GitVcsRoot, config: AccTestConfiguration): Project { +fun nightlyTests(parentProject:String, providerName: String, vcsRoot: GitVcsRoot, config: AccTestConfiguration, cron: NightlyTriggerConfiguration): Project { // Create unique ID for the dynamically-created project var projectId = "${parentProject}_${NightlyTestsProjectId}" @@ -36,11 +36,11 @@ fun nightlyTests(parentProject:String, providerName: String, vcsRoot: GitVcsRoot } // Create build configs to run acceptance tests for each package defined in packages.kt and services.kt files + // and add cron trigger to them all val allPackages = getAllPackageInProviderVersion(providerName) val packageBuildConfigs = BuildConfigurationsForPackages(allPackages, providerName, projectId, vcsRoot, sharedResources, config) - val accTestTrigger = NightlyTriggerConfiguration() packageBuildConfigs.forEach { buildConfiguration -> - buildConfiguration.addTrigger(accTestTrigger) + buildConfiguration.addTrigger(cron) } // Create build config for sweeping the nightly test project @@ -51,7 +51,7 @@ fun nightlyTests(parentProject:String, providerName: String, vcsRoot: GitVcsRoot else -> throw Exception("Provider name not supplied when generating a nightly test subproject") } val serviceSweeperConfig = BuildConfigurationForServiceSweeper(providerName, ServiceSweeperName, sweepersList, projectId, vcsRoot, sharedResources, config) - val sweeperCron = accTestTrigger.clone() + val sweeperCron = cron.clone() sweeperCron.startHour += 5 // Ensure triggered after the package test builds are triggered serviceSweeperConfig.addTrigger(sweeperCron) From 1f85d36029e017cd1a9a63f26226b541adb33fba Mon Sep 17 00:00:00 2001 From: Sarah French Date: Wed, 3 Jul 2024 16:35:43 +0100 Subject: [PATCH 06/11] Add a v6.0.0 testing project that uses branch `FEATURE-BRANCH-major-release-6.0.0` --- .../FEATURE-BRANCH-major-release-6.0.0.kt | 94 +++++++++++++++++++ .../components/projects/root_project.kt | 5 + .../.teamcity/components/unique_id.kt | 4 +- 3 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt b/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt new file mode 100644 index 000000000000..38b5e25ac6cc --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt @@ -0,0 +1,94 @@ +/* + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: MPL-2.0 + */ + +// This file is controlled by MMv1, any changes made here will be overwritten + +package projects.feature_branches + +import ProviderNameBeta +import ProviderNameGa +import builds.* +import jetbrains.buildServer.configs.kotlin.Project +import jetbrains.buildServer.configs.kotlin.vcs.GitVcsRoot +import projects.reused.nightlyTests +import replaceCharsId + +const val branchName = "FEATURE-BRANCH-major-release-6.0.0" + + +// VCS Roots specifically for pulling code from the feature branches in the downstream repos + +object HashicorpVCSRootGa_featureBranchMajorRelease600: GitVcsRoot({ + name = "VCS root for the hashicorp/terraform-provider-${ProviderNameGa} repo @ refs/heads/${branchName}" + url = "https://github.com/hashicorp/terraform-provider-${ProviderNameGa}" + branch = "refs/heads/${branchName}" + branchSpec = "" // empty as we'll access no other branches +}) + +object HashicorpVCSRootBeta_featureBranchMajorRelease600: GitVcsRoot({ + name = "VCS root for the hashicorp/terraform-provider-${ProviderNameBeta} repo @ refs/heads/${branchName}" + url = "https://github.com/hashicorp/terraform-provider-${ProviderNameBeta}" + branch = "refs/heads/${branchName}" + branchSpec = "" // empty as we'll access no other branches +}) + +fun featureBranchMajorRelease600_Project(allConfig: AllContextParameters): Project { + + val projectId = replaceCharsId(branchName) + val gaProjectId = replaceCharsId(projectId + "_GA") + val betaProjectId= replaceCharsId(projectId + "_BETA") + + // Get config for using the GA and VCR identities + val gaConfig = getGaAcceptanceTestConfig(allConfig) + val betaConfig = getBetaAcceptanceTestConfig(allConfig) + + return Project{ + id(projectId) + name = "6.0.0 Major Release Testing" + description = "Subproject for testing feature branch $branchName" + + // Register feature branch-specific VCS roots in the project + vcsRoot(HashicorpVCSRootGa_featureBranchMajorRelease600) + vcsRoot(HashicorpVCSRootBeta_featureBranchMajorRelease600) + + // Nested Nightly Test project that uses hashicorp/terraform-provider-google + subProject( + Project{ + id(gaProjectId) + name = "Google" + subProject( + nightlyTests( + gaProjectId, + ProviderNameGa, + HashicorpVCSRootGa_featureBranchMajorRelease600, + gaConfig, + NightlyTriggerConfiguration(), + ) + ) + } + ) + + // Nested Nightly Test project that uses hashicorp/terraform-provider-google-beta + subProject( + Project { + id(betaProjectId) + name = "Google Beta" + subProject( + nightlyTests( + betaProjectId, + ProviderNameBeta, + HashicorpVCSRootBeta_featureBranchMajorRelease600, + betaConfig, + NightlyTriggerConfiguration(), + ) + ) + } + ) + + params { + readOnlySettings() + } + } +} \ No newline at end of file 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 7130a9c35ea8..208cfc9617da 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/root_project.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/root_project.kt @@ -18,6 +18,8 @@ import generated.ServicesListBeta import generated.ServicesListGa import jetbrains.buildServer.configs.kotlin.Project import jetbrains.buildServer.configs.kotlin.sharedResource +import projects.feature_branches.featureBranchMajorRelease600_Project + // 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. @@ -62,6 +64,9 @@ fun googleCloudRootProject(allConfig: AllContextParameters): Project { subProject(googleSubProjectBeta(allConfig)) subProject(projectSweeperSubProject(allConfig)) + // Feature branch testing + subProject(featureBranchMajorRelease600_Project(allConfig)) // FEATURE-BRANCH-major-release-6.0.0 + params { readOnlySettings() } diff --git a/mmv1/third_party/terraform/.teamcity/components/unique_id.kt b/mmv1/third_party/terraform/.teamcity/components/unique_id.kt index b9a56d762186..ec9e1890d7b5 100644 --- a/mmv1/third_party/terraform/.teamcity/components/unique_id.kt +++ b/mmv1/third_party/terraform/.teamcity/components/unique_id.kt @@ -6,8 +6,8 @@ // 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. fun replaceCharsId(id: String): String{ - var newId = id.replace("-", "") - newId = newId.replace(" ", "_") + // ID should start with a latin letter and contain only latin letters, digits and underscores + var newId = id.replace("-", "").replace(" ", "_").replace(".", "_") newId = newId.uppercase() return newId From 2ece02ad9f7231ce1b6ae31da1b7e992d7b1b8d9 Mon Sep 17 00:00:00 2001 From: Sarah French Date: Wed, 3 Jul 2024 16:37:01 +0100 Subject: [PATCH 07/11] Enable testing feature branches on 1 day a week and main for 6 days a week, differing for GA vs Beta --- .../feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt | 4 ++-- .../.teamcity/components/projects/google_beta_subproject.kt | 3 +-- .../.teamcity/components/projects/google_ga_subproject.kt | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt b/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt index 38b5e25ac6cc..42333422bc2a 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt @@ -64,7 +64,7 @@ fun featureBranchMajorRelease600_Project(allConfig: AllContextParameters): Proje ProviderNameGa, HashicorpVCSRootGa_featureBranchMajorRelease600, gaConfig, - NightlyTriggerConfiguration(), + NightlyTriggerConfiguration(daysOfWeek="5"), // Thursday for GA, TeamCity numbers days Sun=1...Sat=7 ) ) } @@ -81,7 +81,7 @@ fun featureBranchMajorRelease600_Project(allConfig: AllContextParameters): Proje ProviderNameBeta, HashicorpVCSRootBeta_featureBranchMajorRelease600, betaConfig, - NightlyTriggerConfiguration(), + NightlyTriggerConfiguration(daysOfWeek="6"), // Friday for Beta, TeamCity numbers days Sun=1...Sat=7 ) ) } diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt b/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt index 3c4988e043e2..ca9c45d7c8c7 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt @@ -32,8 +32,7 @@ fun googleSubProjectBeta(allConfig: AllContextParameters): Project { description = "Subproject containing builds for testing the Beta version of the Google provider" // Nightly Test project that uses hashicorp/terraform-provider-google-beta - subProject(nightlyTests(betaId, ProviderNameBeta, HashiCorpVCSRootBeta, betaConfig, NightlyTriggerConfiguration())) - + subProject(nightlyTests(betaId, ProviderNameBeta, HashiCorpVCSRootBeta, betaConfig, NightlyTriggerConfiguration(daysOfWeek="1-5,7"))) // All nights except Friday (6) for Beta; feature branch testing happens on Fridays and TeamCity numbers days Sun=1...Sat=7 // MM Upstream project that uses modular-magician/terraform-provider-google-beta subProject(mmUpstream(betaId, ProviderNameBeta, ModularMagicianVCSRootBeta, HashiCorpVCSRootBeta, vcrConfig, NightlyTriggerConfiguration())) diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt b/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt index cd45d7d754c8..9e7e2caa2844 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt @@ -31,7 +31,7 @@ fun googleSubProjectGa(allConfig: AllContextParameters): Project { description = "Subproject containing builds for testing the GA version of the Google provider" // Nightly Test project that uses hashicorp/terraform-provider-google - subProject(nightlyTests(gaId, ProviderNameGa, HashiCorpVCSRootGa, gaConfig, NightlyTriggerConfiguration())) + subProject(nightlyTests(gaId, ProviderNameGa, HashiCorpVCSRootGa, gaConfig, NightlyTriggerConfiguration(daysOfWeek="1-4,6-7"))) // All nights except Thursday (5) for GA; feature branch testing happens on Thursdays and TeamCity numbers days Sun=1...Sat=7 // MM Upstream project that uses modular-magician/terraform-provider-google subProject(mmUpstream(gaId, ProviderNameGa, ModularMagicianVCSRootGa, HashiCorpVCSRootGa, vcrConfig, NightlyTriggerConfiguration())) From 4e121d592a99487c2e780bef9a19a4471c99acb6 Mon Sep 17 00:00:00 2001 From: Sarah French Date: Wed, 3 Jul 2024 17:04:50 +0100 Subject: [PATCH 08/11] Fix build error --- .../terraform/.teamcity/components/builds/build_triggers.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/.teamcity/components/builds/build_triggers.kt b/mmv1/third_party/terraform/.teamcity/components/builds/build_triggers.kt index 7b4576d92390..2880d5015abd 100644 --- a/mmv1/third_party/terraform/.teamcity/components/builds/build_triggers.kt +++ b/mmv1/third_party/terraform/.teamcity/components/builds/build_triggers.kt @@ -22,7 +22,7 @@ class NightlyTriggerConfiguration( var daysOfWeek: String = DefaultDaysOfWeek, val daysOfMonth: String = DefaultDaysOfMonth ){ - public fun clone(): NightlyTriggerConfiguration{ + fun clone(): NightlyTriggerConfiguration{ return NightlyTriggerConfiguration( this.branch, this.nightlyTestsEnabled, @@ -31,7 +31,7 @@ class NightlyTriggerConfiguration( this.daysOfMonth ) } -}) +} fun Triggers.runNightly(config: NightlyTriggerConfiguration) { From c5821de78b2e5f5d494eef5c6369b3190deb51de Mon Sep 17 00:00:00 2001 From: Sarah French Date: Wed, 3 Jul 2024 17:12:33 +0100 Subject: [PATCH 09/11] Fix comment --- .../.teamcity/components/projects/reused/mm_upstream.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/reused/mm_upstream.kt b/mmv1/third_party/terraform/.teamcity/components/projects/reused/mm_upstream.kt index 9492fed89368..288df583bf25 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/reused/mm_upstream.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/reused/mm_upstream.kt @@ -46,7 +46,7 @@ fun mmUpstream(parentProject: String, providerName: String, vcsRoot: GitVcsRoot, else -> throw Exception("Provider name not supplied when generating a nightly test subproject") } - // This build is for manually-initialed runs of sweepers, to test changes to sweepers from the upstream repo + // This build is for manually-initiated runs of sweepers, to test changes to sweepers from the upstream repo val serviceSweeperManualConfig = BuildConfigurationForServiceSweeper(providerName, ServiceSweeperManualName, sweepersList, projectId, vcsRoot, sharedResources, config) // This build runs on a schedule to do actual sweeping of the VCR project, using the downstream repo's code From ef55f56f8759510005768fda6bf22a04d44b1b9f Mon Sep 17 00:00:00 2001 From: Sarah French <15078782+SarahFrench@users.noreply.github.com> Date: Wed, 3 Jul 2024 17:39:46 +0100 Subject: [PATCH 10/11] Fix comment --- .../feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt b/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt index 42333422bc2a..e9b819db8b1e 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt @@ -40,7 +40,7 @@ fun featureBranchMajorRelease600_Project(allConfig: AllContextParameters): Proje val gaProjectId = replaceCharsId(projectId + "_GA") val betaProjectId= replaceCharsId(projectId + "_BETA") - // Get config for using the GA and VCR identities + // Get config for using the GA and Beta identities val gaConfig = getGaAcceptanceTestConfig(allConfig) val betaConfig = getBetaAcceptanceTestConfig(allConfig) From fd1a2272507d09214cf225b2ac05dfb363d3fb98 Mon Sep 17 00:00:00 2001 From: Sarah French Date: Mon, 8 Jul 2024 23:26:16 +0100 Subject: [PATCH 11/11] Make 6.0 project builds use feature branch --- .../FEATURE-BRANCH-major-release-6.0.0.kt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt b/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt index e9b819db8b1e..f34904d69718 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-major-release-6.0.0.kt @@ -17,21 +17,24 @@ import replaceCharsId const val branchName = "FEATURE-BRANCH-major-release-6.0.0" - // VCS Roots specifically for pulling code from the feature branches in the downstream repos object HashicorpVCSRootGa_featureBranchMajorRelease600: GitVcsRoot({ name = "VCS root for the hashicorp/terraform-provider-${ProviderNameGa} repo @ refs/heads/${branchName}" url = "https://github.com/hashicorp/terraform-provider-${ProviderNameGa}" branch = "refs/heads/${branchName}" - branchSpec = "" // empty as we'll access no other branches + branchSpec = """ + +:FEATURE-BRANCH-major-release-6* + """.trimIndent() }) object HashicorpVCSRootBeta_featureBranchMajorRelease600: GitVcsRoot({ name = "VCS root for the hashicorp/terraform-provider-${ProviderNameBeta} repo @ refs/heads/${branchName}" url = "https://github.com/hashicorp/terraform-provider-${ProviderNameBeta}" branch = "refs/heads/${branchName}" - branchSpec = "" // empty as we'll access no other branches + branchSpec = """ + +:FEATURE-BRANCH-major-release-6* + """.trimIndent() }) fun featureBranchMajorRelease600_Project(allConfig: AllContextParameters): Project { @@ -64,7 +67,10 @@ fun featureBranchMajorRelease600_Project(allConfig: AllContextParameters): Proje ProviderNameGa, HashicorpVCSRootGa_featureBranchMajorRelease600, gaConfig, - NightlyTriggerConfiguration(daysOfWeek="5"), // Thursday for GA, TeamCity numbers days Sun=1...Sat=7 + NightlyTriggerConfiguration( + branch = branchName, // Make triggered builds use the feature branch + daysOfWeek = "5" // Thursday for GA, TeamCity numbers days Sun=1...Sat=7 + ), ) ) } @@ -81,7 +87,10 @@ fun featureBranchMajorRelease600_Project(allConfig: AllContextParameters): Proje ProviderNameBeta, HashicorpVCSRootBeta_featureBranchMajorRelease600, betaConfig, - NightlyTriggerConfiguration(daysOfWeek="6"), // Friday for Beta, TeamCity numbers days Sun=1...Sat=7 + NightlyTriggerConfiguration( + branch = branchName, // Make triggered builds use the feature branch + daysOfWeek="6" // Friday for Beta, TeamCity numbers days Sun=1...Sat=7 + ), ) ) }