forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TeamCity: Add project for testing the provider functions feature bran…
…ch (GoogleCloudPlatform#10088) * Add ability to use non-default versions of Terraform in TeamCity builds * Add function to enable making build configs for single packages at a time * Add new sub project that contains 2 builds for testing provider functions the 2 builds: 1) only pulls code from the feature branch on the downstream hashicorp/terraform-provider-google repo 2) only pulls code from the feature branch on the downstream hashicorp/terraform-provider-google-beta repo These builds both use an alpha release of TF 1.8.0 * Add builds for testing auto generated branches in the MM upstream repos These re-use existing VCR Roots. * Make the builds that test the `FEATURE-BRANCH-provider-functions branches in the downstream repos run every night at the default time * Fix defect in 'Download Terraform' build step definition * Update build step to solve bug * Update build_configuration_per_package.kt
- Loading branch information
1 parent
7942a2c
commit b2f5373
Showing
6 changed files
with
142 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
...aform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-provider-functions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
* 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 generated.PackagesListBeta | ||
import generated.PackagesListGa | ||
import jetbrains.buildServer.configs.kotlin.Project | ||
import jetbrains.buildServer.configs.kotlin.vcs.GitVcsRoot | ||
import replaceCharsId | ||
import vcs_roots.ModularMagicianVCSRootBeta | ||
import vcs_roots.ModularMagicianVCSRootGa | ||
|
||
const val featureBranchProviderFunctionsName = "FEATURE-BRANCH-provider-functions" | ||
const val providerFunctionsTfCoreVersion = "1.8.0-alpha20240228" | ||
|
||
// VCS Roots specifically for pulling code from the feature branches in the downstream and upstream repos | ||
object HashicorpVCSRootGa_featureBranchProviderFunctions: GitVcsRoot({ | ||
name = "VCS root for the hashicorp/terraform-provider-${ProviderNameGa} repo @ refs/heads/${featureBranchProviderFunctionsName}" | ||
url = "https://github.com/hashicorp/terraform-provider-${ProviderNameGa}" | ||
branch = "refs/heads/${featureBranchProviderFunctionsName}" | ||
branchSpec = "" // empty as we'll access no other branches | ||
}) | ||
|
||
object HashicorpVCSRootBeta_featureBranchProviderFunctions: GitVcsRoot({ | ||
name = "VCS root for the hashicorp/terraform-provider-${ProviderNameBeta} repo @ refs/heads/${featureBranchProviderFunctionsName}" | ||
url = "https://github.com/hashicorp/terraform-provider-${ProviderNameBeta}" | ||
branch = "refs/heads/${featureBranchProviderFunctionsName}" | ||
branchSpec = "" // empty as we'll access no other branches | ||
}) | ||
|
||
fun featureBranchProviderFunctionSubProject(allConfig: AllContextParameters): Project { | ||
|
||
val projectId = replaceCharsId(featureBranchProviderFunctionsName) | ||
|
||
val packageName = "functions" // This project will contain only builds to test this single package | ||
val sharedResourcesEmpty: List<String> = listOf() // No locking when testing functions | ||
val vcrConfig = getVcrAcceptanceTestConfig(allConfig) // Reused below for both MM testing build configs | ||
val trigger = NightlyTriggerConfiguration() // Resued below for running tests against the downstream repos every night. | ||
|
||
var parentId: String // To be overwritten when each build config is generated below. | ||
|
||
// GA | ||
val gaConfig = getGaAcceptanceTestConfig(allConfig) | ||
// How to make only build configuration to the relevant package(s) | ||
val functionPackageGa = PackagesListGa.getValue(packageName) | ||
|
||
// Enable testing using hashicorp/terraform-provider-google | ||
parentId = "${projectId}_HC_GA" | ||
val buildConfigHashiCorpGa = BuildConfigurationForSinglePackage(packageName, functionPackageGa.getValue("path"), "Provider-Defined Functions (GA provider, HashiCorp downstream)", ProviderNameGa, parentId, HashicorpVCSRootGa_featureBranchProviderFunctions, sharedResourcesEmpty, gaConfig) | ||
buildConfigHashiCorpGa.addTrigger(trigger) | ||
|
||
// Enable testing using modular-magician/terraform-provider-google | ||
parentId = "${projectId}_MM_GA" | ||
val buildConfigModularMagicianGa = BuildConfigurationForSinglePackage(packageName, functionPackageGa.getValue("path"), "Provider-Defined Functions (GA provider, MM upstream)", ProviderNameGa, parentId, ModularMagicianVCSRootGa, sharedResourcesEmpty, vcrConfig) | ||
|
||
// Beta | ||
val betaConfig = getBetaAcceptanceTestConfig(allConfig) | ||
val functionPackageBeta = PackagesListBeta.getValue("functions") | ||
|
||
// Enable testing using hashicorp/terraform-provider-google-beta | ||
parentId = "${projectId}_HC_BETA" | ||
val buildConfigHashiCorpBeta = BuildConfigurationForSinglePackage(packageName, functionPackageBeta.getValue("path"), "Provider-Defined Functions (Beta provider, HashiCorp downstream)", ProviderNameBeta, parentId, HashicorpVCSRootBeta_featureBranchProviderFunctions, sharedResourcesEmpty, betaConfig) | ||
buildConfigHashiCorpBeta.addTrigger(trigger) | ||
|
||
// Enable testing using modular-magician/terraform-provider-google-beta | ||
parentId = "${projectId}_MM_BETA" | ||
val buildConfigModularMagicianBeta = BuildConfigurationForSinglePackage(packageName, functionPackageBeta.getValue("path"), "Provider-Defined Functions (Beta provider, MM upstream)", ProviderNameBeta, parentId, ModularMagicianVCSRootBeta, sharedResourcesEmpty, vcrConfig) | ||
|
||
val allBuildConfigs = listOf(buildConfigHashiCorpGa, buildConfigModularMagicianGa, buildConfigHashiCorpBeta, buildConfigModularMagicianBeta) | ||
|
||
// Make these builds use a 1.8.0-ish version of TF core | ||
allBuildConfigs.forEach{ b -> | ||
b.overrideTerraformCoreVersion(providerFunctionsTfCoreVersion) | ||
} | ||
|
||
return Project{ | ||
id(projectId) | ||
name = featureBranchProviderFunctionsName | ||
description = "Subproject for testing feature branch $featureBranchProviderFunctionsName" | ||
|
||
// Register feature branch-specific VCS roots in the project | ||
vcsRoot(HashicorpVCSRootGa_featureBranchProviderFunctions) | ||
vcsRoot(HashicorpVCSRootBeta_featureBranchProviderFunctions) | ||
|
||
// Register all build configs in the project | ||
allBuildConfigs.forEach{ b -> | ||
buildType(b) | ||
} | ||
|
||
params { | ||
readOnlySettings() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters