Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: TeamCity configuration #23418

Merged
merged 40 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e0d29ba
Initial TeamCity DSL configuration
gdavison Nov 9, 2021
ef61bd6
Renames Composite config
gdavison Nov 10, 2021
a40891e
Adds alternate region
gdavison Nov 10, 2021
96636f1
Adds ACM root domain and limited privileges role ARN
gdavison Nov 10, 2021
56e66d6
Adds parameter `run_nightly_build`
gdavison Nov 10, 2021
a14fa0d
Adds `trigger_day` parameter and defaults to `Sun-Thu`
gdavison Nov 10, 2021
b4517df
Adds alternate account parameters
gdavison Nov 10, 2021
70aaa76
Renames `Composite` build to `FullBuild` and adds `PullRequest`
gdavison Nov 13, 2021
5bee823
Corrects pull request script
gdavison Nov 13, 2021
ce95ae2
Makes timeout a constant
gdavison Nov 13, 2021
ebe132c
Kotlin scoping confuses me
gdavison Nov 13, 2021
257761f
Renames AWS authentication parameters
gdavison Nov 15, 2021
5c70f9e
Renames account lock ids
gdavison Nov 15, 2021
3fc3a97
Actually adds pull request test runner script
gdavison Nov 15, 2021
305d446
Missed a set of lock ids
gdavison Nov 16, 2021
0d2079d
Adds VPC lock
gdavison Nov 16, 2021
4e7e6c0
Adds VPC lock to more services
gdavison Nov 17, 2021
f963e3e
Adds VPC lock to `eks`
gdavison Nov 17, 2021
9de64c5
Adds VPC lock to `opsworks`
gdavison Nov 19, 2021
6ded96f
Renames `config` to `configservice` and adds VPC lock to more services
gdavison Nov 27, 2021
c6ba6e9
Fixes service naming
gdavison Nov 30, 2021
6cdb21e
Adds VPC lock to additional services and adds parallelism override
gdavison Nov 30, 2021
4dadaa9
Renames services
gdavison Dec 1, 2021
f965221
Adds VPC lock to more services
gdavison Dec 1, 2021
b1842d0
Ensures `goenv` is up-to-date
gdavison Feb 3, 2022
40d46ac
Sets `env.TF_LOG`
gdavison Feb 25, 2022
3e83e6f
Clean up
gdavison Mar 1, 2022
6e9ead9
Makes `TF_LOG` an optional parameter
gdavison Mar 4, 2022
004c223
Adds provider-level acceptance tests
gdavison Mar 30, 2022
ca702f5
Adds handling for Go tests to Setup step
gdavison Mar 30, 2022
552c046
Merge branch 'main' into teamcity
gdavison Jun 16, 2022
fd97dbd
Adds `kendra` and `route53domains` to acceptance tests
gdavison Jun 16, 2022
9febee5
Adds generator for TeamCity main acceptance test services list
gdavison Jun 20, 2022
644aa72
Adds `TestAcc` filter to provider acceptance tests. Runs sweepers eve…
gdavison Jun 21, 2022
ea1abd0
Moves configuration for TeamCity acceptance test configurations to th…
gdavison Jun 21, 2022
4112ba3
Import order fix
gdavison Jun 23, 2022
231e847
Formatting cleanup
gdavison Jul 13, 2022
b9e23ac
Adds validation for generated TeamCity config
gdavison Jul 13, 2022
743f557
Merge branch 'main' into teamcity
gdavison Jul 13, 2022
55d9468
Merge branch 'main' into teamcity
gdavison Jul 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ aws/testdata/service/cloudformation/examplecompany-exampleservice-exampleresourc
*.winfile eol=crlf
/.vs
node_modules

.teamcity/target
1 change: 1 addition & 0 deletions .teamcity/.java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
corretto64-11.0.13
18 changes: 18 additions & 0 deletions .teamcity/components/generated/service_orgacct.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
val orgacctServices = mapOf(
"accessanalyzer" to ServiceSpec("Access Analyzer"),
"backup" to ServiceSpec("Backup", "TestAccBackupGlobalSettings_basic"),
"cloudformation" to ServiceSpec(
"CloudFormation",
"TestAccCloudFormationStackSet_PermissionModel_serviceManaged|TestAccCloudFormationStackSetInstance_deploymentTargets"
),
"cloudtrail" to ServiceSpec("CloudTrail"),
"config" to ServiceSpec("Config" /*"TestAccConfig_serial|TestAccConfigConfigurationAggregator_"*/),
"fms" to ServiceSpec("FMS"),
"guardduty" to ServiceSpec("GuardDuty"),
"macie2" to ServiceSpec("Macie2"),
"organizations" to ServiceSpec("Organizations"),
"securityhub" to ServiceSpec(
"SecurityHub",
"TestAccSecurityHub_serial/Account|TestAccSecurityHub_serial/OrganizationAdminAccount|TestAccSecurityHub_serial/OrganizationConfiguration"
),
)
155 changes: 155 additions & 0 deletions .teamcity/components/generated/services_all.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
val services = mapOf(
"accessanalyzer" to ServiceSpec("Access Analyzer"),
"acm" to ServiceSpec("ACM"),
"acmpca" to ServiceSpec("ACM PCA"),
"amp" to ServiceSpec("AMP"),
"amplify" to ServiceSpec("Amplify"),
"apigateway" to ServiceSpec("API Gateway"),
"apigatewayv2" to ServiceSpec("API Gateway v2"),
"appautoscaling" to ServiceSpec("Application Auto Scaling", vpcLock = true),
"appconfig" to ServiceSpec("AppConfig"),
"appmesh" to ServiceSpec("App Mesh"),
"apprunner" to ServiceSpec("AppRunner"),
"appstream" to ServiceSpec("AppStream", vpcLock = true, parallelismOverride = 10),
"appsync" to ServiceSpec("AppSync"),
"athena" to ServiceSpec("Athena"),
"autoscaling" to ServiceSpec("Auto Scaling", vpcLock = true),
"autoscalingplans" to ServiceSpec("Auto Scaling Plans"),
"backup" to ServiceSpec("Backup"),
"batch" to ServiceSpec("Batch", vpcLock = true),
"budgets" to ServiceSpec("Budgets"),
"chime" to ServiceSpec("Chime"),
"cloud9" to ServiceSpec("Cloud9"),
"cloudcontrol" to ServiceSpec("CloudControl"),
"cloudformation" to ServiceSpec("CloudFormation", vpcLock = true),
"cloudfront" to ServiceSpec("CloudFront"),
"cloudhsmv2" to ServiceSpec("CloudHSM v2", vpcLock = true),
"cloudtrail" to ServiceSpec("CloudTrail"),
"cloudwatch" to ServiceSpec("CloudWatch"),
"cloudwatchlogs" to ServiceSpec("CloudWatch Logs"),
"codeartifact" to ServiceSpec("CodeArtifact"),
"codebuild" to ServiceSpec("CodeBuild"),
"codecommit" to ServiceSpec("CodeCommit"),
"codedeploy" to ServiceSpec("CodeDeploy"),
"codepipeline" to ServiceSpec("CodePipeline"),
"codestarconnections" to ServiceSpec("CodeStar Connections"),
"codestarnotifications" to ServiceSpec("CodeStar Notifications"),
"cognitoidentity" to ServiceSpec("Cognito Identity"),
"cognitoidp" to ServiceSpec("Cognito Identity Provider"),
"configservice" to ServiceSpec("Config Service"),
"connect" to ServiceSpec("Connect"),
"cur" to ServiceSpec("Cost and Usage Report Service"),
"dataexchange" to ServiceSpec("DataExchange"),
"datapipeline" to ServiceSpec("Data Pipeline"),
"datasync" to ServiceSpec("DataSync", vpcLock = true),
"dax" to ServiceSpec("DAX"),
"devicefarm" to ServiceSpec("Device Farm"),
"directconnect" to ServiceSpec("Direct Connect", vpcLock = true),
"dlm" to ServiceSpec("DLM"),
"dms" to ServiceSpec("Database Migration Service", vpcLock = true),
"docdb" to ServiceSpec("DocDB", vpcLock = true),
"ds" to ServiceSpec("Directory Service", vpcLock = true),
"dynamodb" to ServiceSpec("DynamoDB"),
"ec2" to ServiceSpec("EC2", vpcLock = true),
"ecr" to ServiceSpec("ECR"),
"ecrpublic" to ServiceSpec("ECR Public"),
"ecs" to ServiceSpec("ECS"),
"efs" to ServiceSpec("EFS", vpcLock = true),
"eks" to ServiceSpec("EKS", vpcLock = true),
"elasticache" to ServiceSpec("ElastiCache", vpcLock = true),
"elasticbeanstalk" to ServiceSpec("Elastic Beanstalk", vpcLock = true),
"elasticsearch" to ServiceSpec("Elasticsearch Service", vpcLock = true),
"elastictranscoder" to ServiceSpec("Elastic Transcoder"),
"elb" to ServiceSpec("Elastic Load Balancing", vpcLock = true),
"elbv2" to ServiceSpec("Elastic Load Balancing v2", vpcLock = true),
"emr" to ServiceSpec("EMR", vpcLock = true),
"events" to ServiceSpec("CloudWatch Events"),
"firehose" to ServiceSpec("Firehose"),
"fms" to ServiceSpec("FMS"),
"fsx" to ServiceSpec("FSx", vpcLock = true),
"gamelift" to ServiceSpec("GameLift"),
"glacier" to ServiceSpec("Glacier"),
"globalaccelerator" to ServiceSpec("Global Accelerator"),
"glue" to ServiceSpec("Glue"),
"greengrass" to ServiceSpec("Greengrass"),
"guardduty" to ServiceSpec("GuardDuty"),
"iam" to ServiceSpec("IAM"),
"identitystore" to ServiceSpec("SSO Identitystore"),
"imagebuilder" to ServiceSpec("EC2 Image Builder"),
"inspector" to ServiceSpec("Inspector"),
"iot" to ServiceSpec("IoT"),
"iotanalytics" to ServiceSpec("IoT Analytics"),
"iotevents" to ServiceSpec("IoT Events"),
"kafka" to ServiceSpec("Kafka", vpcLock = true),
"kinesis" to ServiceSpec("Kinesis"),
"kinesisanalytics" to ServiceSpec("Kinesis Analytics"),
"kinesisanalyticsv2" to ServiceSpec("Kinesis Analytics v2"),
"kinesisvideo" to ServiceSpec("Kinesis Video"),
"kms" to ServiceSpec("KMS"),
"lakeformation" to ServiceSpec("LakeFormation"),
"lambda" to ServiceSpec("Lambda", vpcLock = true),
"lexmodels" to ServiceSpec("Lex Model Building Service"),
"licensemanager" to ServiceSpec("License Manager"),
"lightsail" to ServiceSpec("Lightsail"),
"macie" to ServiceSpec("Macie"),
"macie2" to ServiceSpec("Macie2"),
"mediaconnect" to ServiceSpec("MediaConnect"),
"mediaconvert" to ServiceSpec("MediaConvert"),
"medialive" to ServiceSpec("MediaLive"),
"mediapackage" to ServiceSpec("MediaPackage"),
"mediastore" to ServiceSpec("MediaStore"),
"meta" to ServiceSpec("Provider-level Data Sources"),
"mq" to ServiceSpec("MQ", vpcLock = true),
"mwaa" to ServiceSpec("MWAA", vpcLock = true),
"neptune" to ServiceSpec("Neptune"),
"networkfirewall" to ServiceSpec("Network Firewall", vpcLock = true),
"networkmanager" to ServiceSpec("NetworkManager"),
"opsworks" to ServiceSpec("OpsWorks", vpcLock = true),
"organizations" to ServiceSpec("Organizations"),
"outposts" to ServiceSpec("Outposts"),
"pinpoint" to ServiceSpec("Pinpoint"),
"pricing" to ServiceSpec("Pricing"),
"qldb" to ServiceSpec("QLDB"),
"quicksight" to ServiceSpec("QuickSight"),
"ram" to ServiceSpec("RAM"),
"rds" to ServiceSpec("RDS", vpcLock = true),
"redshift" to ServiceSpec("Redshift", vpcLock = true),
"resourcegroups" to ServiceSpec("Resource Groups"),
"resourcegroupstaggingapi" to ServiceSpec("Resource Groups Tagging API"),
"route53" to ServiceSpec("Route 53", vpcLock = true),
"route53recoverycontrolconfig" to ServiceSpec("Route53 Recovery Control Config"),
"route53recoveryreadiness" to ServiceSpec("Route53 Recovery Readiness"),
"route53resolver" to ServiceSpec("Route53Resolver", vpcLock = true),
"s3" to ServiceSpec("S3"),
"s3control" to ServiceSpec("S3 Control"),
"s3outposts" to ServiceSpec("S3Outposts"),
"sagemaker" to ServiceSpec("SageMaker", vpcLock = true),
"schemas" to ServiceSpec("Schemas"),
"secretsmanager" to ServiceSpec("Secrets Manager"),
"securityhub" to ServiceSpec("SecurityHub"),
"serverlessrepo" to ServiceSpec("Serverless Application Repository"),
"servicecatalog" to ServiceSpec("Service Catalog"),
"servicediscovery" to ServiceSpec("ServiceDiscovery", vpcLock = true),
"servicequotas" to ServiceSpec("Service Quotas"),
"ses" to ServiceSpec("SES"),
"sfn" to ServiceSpec("SFN"),
"shield" to ServiceSpec("Shield"),
"signer" to ServiceSpec("Signer"),
"simpledb" to ServiceSpec("SimpleDB"),
"sns" to ServiceSpec("SNS"),
"sqs" to ServiceSpec("SQS"),
"ssm" to ServiceSpec("SSM", vpcLock = true),
"ssoadmin" to ServiceSpec("SSO Admin"),
"storagegateway" to ServiceSpec("Storage Gateway", vpcLock = true),
"sts" to ServiceSpec("STS"),
"swf" to ServiceSpec("SWF"),
"synthetics" to ServiceSpec("Synthetics", parallelismOverride = 10),
"timestreamwrite" to ServiceSpec("Timestream Write"),
"transfer" to ServiceSpec("Transfer", vpcLock = true),
"waf" to ServiceSpec("WAF"),
"wafregional" to ServiceSpec("WAF Regional"),
"wafv2" to ServiceSpec("WAF v2"),
"worklink" to ServiceSpec("WorkLink"),
"workspaces" to ServiceSpec("WorkSpaces", vpcLock = true),
"xray" to ServiceSpec("XRay"),
)
74 changes: 74 additions & 0 deletions .teamcity/components/service_build_config.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import jetbrains.buildServer.configs.kotlin.v2019_2.AbsoluteId
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
import jetbrains.buildServer.configs.kotlin.v2019_2.DslContext
import jetbrains.buildServer.configs.kotlin.v2019_2.ParameterDisplay
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
import java.io.File

data class ServiceSpec(
val readableName: String,
val patternOverride: String? = null,
val vpcLock: Boolean = false,
val parallelismOverride: Int? = null,
)

class Service(name: String, spec: ServiceSpec) {
val packageName = name
val spec = spec

fun buildType(): BuildType {
return BuildType {
id = DslContext.createId("ServiceTest_$packageName")

name = "2. ${spec.readableName} - Tests"

vcs {
root(AbsoluteId(DslContext.getParameter("vcs_root_id")))
cleanCheckout = true
}

if (spec.patternOverride != null) {
params {
text("TEST_PATTERN", spec.patternOverride, display = ParameterDisplay.HIDDEN)
}
}
if (spec.parallelismOverride != null) {
params {
text("ACCTEST_PARALLELISM", spec.parallelismOverride.toString(), display = ParameterDisplay.HIDDEN)
}
}

val serviceDir = "./internal/service/$packageName"
steps {
script {
name = "Setup GOENV"
scriptContent = File("./scripts/setup_goenv.sh").readText()
}
script {
name = "Compile Test Binary"
workingDir = serviceDir
scriptContent = File("./scripts/service_tests/compile_test_binary.sh").readText()
}
script {
name = "Run Unit Tests"
workingDir = serviceDir
scriptContent = File("./scripts/service_tests/unit_tests.sh").readText()
}
script {
name = "Run Acceptance Tests"
workingDir = serviceDir
scriptContent = File("./scripts/service_tests/acceptance_tests.sh").readText()
}
}

if (spec.vpcLock) {
features {
feature {
type = "JetBrains.SharedResources"
param("locks-param", "${DslContext.getParameter("aws_account.vpc_lock_id")} readLock")
}
}
}
}
}
}
109 changes: 109 additions & 0 deletions .teamcity/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0"?>
<project>
<modelVersion>4.0.0</modelVersion>
<name>AWS TeamCity Config DSL Script</name>
<groupId>TeamCity-Config-DSL-Script</groupId>
<artifactId>TeamCity-Config-DSL-Script</artifactId>
<version>1.0-SNAPSHOT</version>

<parent>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<repositories>
<repository>
<id>jetbrains-all</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>teamcity-server</id>
<url>https://ci-oss.hashicorp.engineering/app/dsl-plugins-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>JetBrains</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
</pluginRepository>
</pluginRepositories>

<build>
<sourceDirectory>${basedir}</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>

<configuration/>
<executions>
<execution>
<id>compile</id>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>process-test-sources</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>teamcity-configs-maven-plugin</artifactId>
<version>${teamcity.dsl.version}</version>
<configuration>
<format>kotlin</format>
<dstDir>target/generated-configs</dstDir>
<!-- For testing -->
<!--<contextParameters>
<run_nightly_build>true</run_nightly_build>
<trigger_time>02:05 America/Vancouver</trigger_time>
</contextParameters>-->
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin</artifactId>
<version>${teamcity.dsl.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-plugins</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-script-runtime</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
17 changes: 17 additions & 0 deletions .teamcity/scripts/provider_tests/unit_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -euo pipefail

# All of internal except for internal/service. This list should be generated.
go test \
./internal/acctest/... \
./internal/conns/... \
./internal/create/... \
./internal/experimental/... \
./internal/flex/... \
./internal/generate/... \
./internal/provider/... \
./internal/tags/... \
./internal/tfresource/... \
./internal/vault/... \
./internal/verify/...
Loading