From a0484f92ae5756399c44ddc8a1f47c0afaeb8c30 Mon Sep 17 00:00:00 2001 From: Michael Kaiser Date: Sat, 4 Apr 2026 22:35:14 -0500 Subject: [PATCH] feat(scripts): add build-toolkit using CDK Toolkit Library and fix deprecations - Add scripts/build-toolkit/ - TypeScript build runner using @aws-cdk/toolkit-lib for programmatic synthesis with structured warning/deprecation capture - Supports all 5 languages: TypeScript, Python, Java, Go, C#/.NET - Fix Node 16 runtime deprecation in s3-sns-lambda-chain (use NODEJS_LATEST) - Fix V1 pipeline type in codepipeline-build-deploy, elasticbeanstalk-bg-pipeline, lambda-api-ci (use PipelineType.V2) - Fix Python 3.6 runtime in elasticbeanstalk-bg-pipeline (use PYTHON_3_12) - Fix installLatestAwsSdk deprecation in ddb/global-table-with-cmk - Fix all C# projects: net6.0 -> net8.0 (EOL framework), including capitalize-string asset path and aws-lambda-tools-defaults.json - Fix deprecated 'dotnet run -p' -> 'dotnet run --project' in all C# cdk.json - Fix go/httpapi-lambda test: Template_FromStack API change (add nil opts) - Fix Go build command in build-toolkit (go build, not go build ./...) --- csharp/CloudFront-S3-WAF/src/src.csproj | 2 +- csharp/api-cors-lambda-crud-dynamodb/cdk.json | 2 +- .../src/CDK/cdk.csproj | 2 +- .../Lambda/AuthFunction/AuthFunction.csproj | 2 +- .../BackendFunction/BackendFunction.csproj | 2 +- csharp/application-load-balancer/cdk.json | 2 +- .../ApplicationLoadBalancer.csproj | 2 +- csharp/appsync-graphql-dynamodb/cdk.json | 2 +- .../AppsyncGraphqlDynamodb.csproj | 2 +- .../CapitalizeStringHandler.csproj | 2 +- .../aws-lambda-tools-defaults.json | 2 +- .../CapitalizeStringHandler.Tests.csproj | 2 +- csharp/capitalize-string/cdk.json | 2 +- .../CapitalizeString/CapitalizeStringStack.cs | 2 +- csharp/classic-load-balancer/cdk.json | 2 +- .../ClassicLoadBalancer.csproj | 2 +- .../CustomResourceCloudFrontInvalidate.csproj | 2 +- .../Ec2InstanceDevServer.csproj | 2 +- .../src/Ec2Instance/Ec2Instance.csproj | 2 +- .../elasticbeanstalk-bg-pipeline/cdk.json | 2 +- .../ElasticbeanstalkBgPipeline.csproj | 2 +- .../elasticbeanstalk-environment/cdk.json | 2 +- .../ElasticbeanstalkEnvironment.csproj | 2 +- .../src/src.csproj | 2 +- csharp/lambda-cron/cdk.json | 2 +- .../LambdaCron.Tests/LambdaCron.Tests.csproj | 2 +- .../src/LambdaCron/LambdaCron.csproj | 2 +- csharp/my-widget-service/cdk.json | 2 +- .../MyWidgetService/MyWidgetService.csproj | 2 +- .../src/RandomWriter/RandomWriter.csproj | 2 +- csharp/static-site/cdk.json | 2 +- .../src/StaticSite/StaticSite.csproj | 2 +- csharp/stepfunctions-job-poller/cdk.json | 2 +- .../StepfunctionsJobPoller.csproj | 2 +- go/httpapi-lambda/httpapi-lambda_test.go | 2 +- scripts/build-toolkit/.gitignore | 4 + scripts/build-toolkit/README.md | 113 ++++++++++++++++++ scripts/build-toolkit/package.json | 19 +++ scripts/build-toolkit/src/build.ts | 82 +++++++++++++ scripts/build-toolkit/src/discover.ts | 59 +++++++++ scripts/build-toolkit/src/index.ts | 62 ++++++++++ scripts/build-toolkit/src/orchestrator.ts | 91 ++++++++++++++ scripts/build-toolkit/src/report.ts | 53 ++++++++ scripts/build-toolkit/src/runner.ts | 36 ++++++ scripts/build-toolkit/src/synth.ts | 79 ++++++++++++ scripts/build-toolkit/src/types.ts | 43 +++++++ scripts/build-toolkit/tsconfig.json | 19 +++ .../lib/codepipeline-build-deploy-stack.ts | 1 + typescript/ddb/global-table-with-cmk/cdk.json | 1 + .../elasticbeanstalk-bg-pipeline/index.ts | 6 +- typescript/lambda-api-ci/lib/ci-stack.ts | 6 +- typescript/s3-sns-lambda-chain/cdk.json | 5 +- 52 files changed, 709 insertions(+), 40 deletions(-) create mode 100644 scripts/build-toolkit/.gitignore create mode 100644 scripts/build-toolkit/README.md create mode 100644 scripts/build-toolkit/package.json create mode 100644 scripts/build-toolkit/src/build.ts create mode 100644 scripts/build-toolkit/src/discover.ts create mode 100644 scripts/build-toolkit/src/index.ts create mode 100644 scripts/build-toolkit/src/orchestrator.ts create mode 100644 scripts/build-toolkit/src/report.ts create mode 100644 scripts/build-toolkit/src/runner.ts create mode 100644 scripts/build-toolkit/src/synth.ts create mode 100644 scripts/build-toolkit/src/types.ts create mode 100644 scripts/build-toolkit/tsconfig.json diff --git a/csharp/CloudFront-S3-WAF/src/src.csproj b/csharp/CloudFront-S3-WAF/src/src.csproj index 17e8f9efa1..9382e8f144 100644 --- a/csharp/CloudFront-S3-WAF/src/src.csproj +++ b/csharp/CloudFront-S3-WAF/src/src.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable enable latest diff --git a/csharp/api-cors-lambda-crud-dynamodb/cdk.json b/csharp/api-cors-lambda-crud-dynamodb/cdk.json index a6bad0c1bf..6bc560622c 100644 --- a/csharp/api-cors-lambda-crud-dynamodb/cdk.json +++ b/csharp/api-cors-lambda-crud-dynamodb/cdk.json @@ -1,5 +1,5 @@ { - "app": "dotnet run -p src/ApiCorsLambdaCrudDynamodb/ApiCorsLambdaCrudDynamodb.csproj", + "app": "dotnet run --project src/ApiCorsLambdaCrudDynamodb/ApiCorsLambdaCrudDynamodb.csproj", "watch": { "include": [ "**" diff --git a/csharp/apigateway-cognito-lambda-dynamodb/src/CDK/cdk.csproj b/csharp/apigateway-cognito-lambda-dynamodb/src/CDK/cdk.csproj index f8dc072403..27ef0ac551 100644 --- a/csharp/apigateway-cognito-lambda-dynamodb/src/CDK/cdk.csproj +++ b/csharp/apigateway-cognito-lambda-dynamodb/src/CDK/cdk.csproj @@ -1,7 +1,7 @@ Exe - net6.0 + net8.0 apigateway_cognito_lambda_dynamodb enable enable diff --git a/csharp/apigateway-cognito-lambda-dynamodb/src/Lambda/AuthFunction/AuthFunction.csproj b/csharp/apigateway-cognito-lambda-dynamodb/src/Lambda/AuthFunction/AuthFunction.csproj index 59e005455e..efefc8b836 100644 --- a/csharp/apigateway-cognito-lambda-dynamodb/src/Lambda/AuthFunction/AuthFunction.csproj +++ b/csharp/apigateway-cognito-lambda-dynamodb/src/Lambda/AuthFunction/AuthFunction.csproj @@ -1,6 +1,6 @@ - net6.0 + net8.0 enable enable true diff --git a/csharp/apigateway-cognito-lambda-dynamodb/src/Lambda/BackendFunction/BackendFunction.csproj b/csharp/apigateway-cognito-lambda-dynamodb/src/Lambda/BackendFunction/BackendFunction.csproj index 083f3a91ed..b9953ecd8e 100644 --- a/csharp/apigateway-cognito-lambda-dynamodb/src/Lambda/BackendFunction/BackendFunction.csproj +++ b/csharp/apigateway-cognito-lambda-dynamodb/src/Lambda/BackendFunction/BackendFunction.csproj @@ -1,6 +1,6 @@ - net6.0 + net8.0 enable enable true diff --git a/csharp/application-load-balancer/cdk.json b/csharp/application-load-balancer/cdk.json index 563183daa8..7eb488b8ba 100644 --- a/csharp/application-load-balancer/cdk.json +++ b/csharp/application-load-balancer/cdk.json @@ -1,3 +1,3 @@ { - "app": "dotnet run -p src/ApplicationLoadBalancer/ApplicationLoadBalancer.csproj" + "app": "dotnet run --project src/ApplicationLoadBalancer/ApplicationLoadBalancer.csproj" } diff --git a/csharp/application-load-balancer/src/ApplicationLoadBalancer/ApplicationLoadBalancer.csproj b/csharp/application-load-balancer/src/ApplicationLoadBalancer/ApplicationLoadBalancer.csproj index 0fd3ad2da3..39e0a599e2 100644 --- a/csharp/application-load-balancer/src/ApplicationLoadBalancer/ApplicationLoadBalancer.csproj +++ b/csharp/application-load-balancer/src/ApplicationLoadBalancer/ApplicationLoadBalancer.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Major diff --git a/csharp/appsync-graphql-dynamodb/cdk.json b/csharp/appsync-graphql-dynamodb/cdk.json index b60de9bfe9..a8ed9a19b1 100644 --- a/csharp/appsync-graphql-dynamodb/cdk.json +++ b/csharp/appsync-graphql-dynamodb/cdk.json @@ -1,3 +1,3 @@ { - "app": "dotnet run -p src/AppsyncGraphqlDynamodb/AppsyncGraphqlDynamodb.csproj" + "app": "dotnet run --project src/AppsyncGraphqlDynamodb/AppsyncGraphqlDynamodb.csproj" } diff --git a/csharp/appsync-graphql-dynamodb/src/AppsyncGraphqlDynamodb/AppsyncGraphqlDynamodb.csproj b/csharp/appsync-graphql-dynamodb/src/AppsyncGraphqlDynamodb/AppsyncGraphqlDynamodb.csproj index 0fd3ad2da3..39e0a599e2 100644 --- a/csharp/appsync-graphql-dynamodb/src/AppsyncGraphqlDynamodb/AppsyncGraphqlDynamodb.csproj +++ b/csharp/appsync-graphql-dynamodb/src/AppsyncGraphqlDynamodb/AppsyncGraphqlDynamodb.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Major diff --git a/csharp/capitalize-string/CapitalizeStringHandler/src/CapitalizeStringHandler/CapitalizeStringHandler.csproj b/csharp/capitalize-string/CapitalizeStringHandler/src/CapitalizeStringHandler/CapitalizeStringHandler.csproj index 5345fd6f1f..f1d6008bd3 100644 --- a/csharp/capitalize-string/CapitalizeStringHandler/src/CapitalizeStringHandler/CapitalizeStringHandler.csproj +++ b/csharp/capitalize-string/CapitalizeStringHandler/src/CapitalizeStringHandler/CapitalizeStringHandler.csproj @@ -1,6 +1,6 @@ - net6.0 + net8.0 true Lambda diff --git a/csharp/capitalize-string/CapitalizeStringHandler/src/CapitalizeStringHandler/aws-lambda-tools-defaults.json b/csharp/capitalize-string/CapitalizeStringHandler/src/CapitalizeStringHandler/aws-lambda-tools-defaults.json index 19f0997192..2e3caa5d81 100644 --- a/csharp/capitalize-string/CapitalizeStringHandler/src/CapitalizeStringHandler/aws-lambda-tools-defaults.json +++ b/csharp/capitalize-string/CapitalizeStringHandler/src/CapitalizeStringHandler/aws-lambda-tools-defaults.json @@ -11,7 +11,7 @@ "profile": "", "region": "", "configuration": "Release", - "framework": "net6.0", + "framework": "net8.0", "function-runtime": "dotnetcore3.1", "function-memory-size": 256, "function-timeout": 30, diff --git a/csharp/capitalize-string/CapitalizeStringHandler/test/CapitalizeStringHandler.Tests/CapitalizeStringHandler.Tests.csproj b/csharp/capitalize-string/CapitalizeStringHandler/test/CapitalizeStringHandler.Tests/CapitalizeStringHandler.Tests.csproj index 4f3f1a6ff3..5596aeb79a 100644 --- a/csharp/capitalize-string/CapitalizeStringHandler/test/CapitalizeStringHandler.Tests/CapitalizeStringHandler.Tests.csproj +++ b/csharp/capitalize-string/CapitalizeStringHandler/test/CapitalizeStringHandler.Tests/CapitalizeStringHandler.Tests.csproj @@ -1,6 +1,6 @@ - net6.0 + net8.0 diff --git a/csharp/capitalize-string/cdk.json b/csharp/capitalize-string/cdk.json index cb9c079d2b..e63c88de57 100644 --- a/csharp/capitalize-string/cdk.json +++ b/csharp/capitalize-string/cdk.json @@ -1,3 +1,3 @@ { - "app": "dotnet publish -c Release CapitalizeStringHandler/src/CapitalizeStringHandler; dotnet run -p src/CapitalizeString" + "app": "dotnet publish -c Release CapitalizeStringHandler/src/CapitalizeStringHandler; dotnet run --project src/CapitalizeString" } \ No newline at end of file diff --git a/csharp/capitalize-string/src/CapitalizeString/CapitalizeStringStack.cs b/csharp/capitalize-string/src/CapitalizeString/CapitalizeStringStack.cs index b985bdd77d..f43f8dd60d 100644 --- a/csharp/capitalize-string/src/CapitalizeString/CapitalizeStringStack.cs +++ b/csharp/capitalize-string/src/CapitalizeString/CapitalizeStringStack.cs @@ -11,7 +11,7 @@ internal CapitalizeStringStack(Construct scope, string id, IStackProps props = n Function fn = new Function(this, "capitalizestring", new FunctionProps { Runtime = Runtime.DOTNET_8, - Code = Code.FromAsset("./CapitalizeStringHandler/src/CapitalizeStringHandler/bin/Release/net6.0/publish"), + Code = Code.FromAsset("./CapitalizeStringHandler/src/CapitalizeStringHandler/bin/Release/net8.0/publish"), Handler = "CapitalizeStringHandler::CapitalizeStringHandler.Function::FunctionHandler" }); } diff --git a/csharp/classic-load-balancer/cdk.json b/csharp/classic-load-balancer/cdk.json index b4171fda5c..fbdf0ef956 100644 --- a/csharp/classic-load-balancer/cdk.json +++ b/csharp/classic-load-balancer/cdk.json @@ -1,3 +1,3 @@ { - "app": "dotnet run -p src/ClassicLoadBalancer/ClassicLoadBalancer.csproj" + "app": "dotnet run --project src/ClassicLoadBalancer/ClassicLoadBalancer.csproj" } diff --git a/csharp/classic-load-balancer/src/ClassicLoadBalancer/ClassicLoadBalancer.csproj b/csharp/classic-load-balancer/src/ClassicLoadBalancer/ClassicLoadBalancer.csproj index 0fd3ad2da3..39e0a599e2 100644 --- a/csharp/classic-load-balancer/src/ClassicLoadBalancer/ClassicLoadBalancer.csproj +++ b/csharp/classic-load-balancer/src/ClassicLoadBalancer/ClassicLoadBalancer.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Major diff --git a/csharp/custom-resource-cloudfront-invalidate/src/CustomResourceCloudFrontInvalidate/CustomResourceCloudFrontInvalidate.csproj b/csharp/custom-resource-cloudfront-invalidate/src/CustomResourceCloudFrontInvalidate/CustomResourceCloudFrontInvalidate.csproj index 9b74dec707..7aa9064cd0 100644 --- a/csharp/custom-resource-cloudfront-invalidate/src/CustomResourceCloudFrontInvalidate/CustomResourceCloudFrontInvalidate.csproj +++ b/csharp/custom-resource-cloudfront-invalidate/src/CustomResourceCloudFrontInvalidate/CustomResourceCloudFrontInvalidate.csproj @@ -1,7 +1,7 @@ Exe - net6.0 + net8.0 Major diff --git a/csharp/ec2-instance-dev-server/src/Ec2InstanceDevServer/Ec2InstanceDevServer.csproj b/csharp/ec2-instance-dev-server/src/Ec2InstanceDevServer/Ec2InstanceDevServer.csproj index 20289e2a13..2ef8b2a7c5 100644 --- a/csharp/ec2-instance-dev-server/src/Ec2InstanceDevServer/Ec2InstanceDevServer.csproj +++ b/csharp/ec2-instance-dev-server/src/Ec2InstanceDevServer/Ec2InstanceDevServer.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Major diff --git a/csharp/ec2-instance/src/Ec2Instance/Ec2Instance.csproj b/csharp/ec2-instance/src/Ec2Instance/Ec2Instance.csproj index 1778450931..f1d752d354 100644 --- a/csharp/ec2-instance/src/Ec2Instance/Ec2Instance.csproj +++ b/csharp/ec2-instance/src/Ec2Instance/Ec2Instance.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Major diff --git a/csharp/elasticbeanstalk/elasticbeanstalk-bg-pipeline/cdk.json b/csharp/elasticbeanstalk/elasticbeanstalk-bg-pipeline/cdk.json index 9ee5587633..22bd3510c8 100644 --- a/csharp/elasticbeanstalk/elasticbeanstalk-bg-pipeline/cdk.json +++ b/csharp/elasticbeanstalk/elasticbeanstalk-bg-pipeline/cdk.json @@ -1,3 +1,3 @@ { - "app": "dotnet run -p src/ElasticbeanstalkBgPipeline/ElasticbeanstalkBgPipeline.csproj" + "app": "dotnet run --project src/ElasticbeanstalkBgPipeline/ElasticbeanstalkBgPipeline.csproj" } diff --git a/csharp/elasticbeanstalk/elasticbeanstalk-bg-pipeline/src/ElasticbeanstalkBgPipeline/ElasticbeanstalkBgPipeline.csproj b/csharp/elasticbeanstalk/elasticbeanstalk-bg-pipeline/src/ElasticbeanstalkBgPipeline/ElasticbeanstalkBgPipeline.csproj index 0fd3ad2da3..39e0a599e2 100644 --- a/csharp/elasticbeanstalk/elasticbeanstalk-bg-pipeline/src/ElasticbeanstalkBgPipeline/ElasticbeanstalkBgPipeline.csproj +++ b/csharp/elasticbeanstalk/elasticbeanstalk-bg-pipeline/src/ElasticbeanstalkBgPipeline/ElasticbeanstalkBgPipeline.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Major diff --git a/csharp/elasticbeanstalk/elasticbeanstalk-environment/cdk.json b/csharp/elasticbeanstalk/elasticbeanstalk-environment/cdk.json index da03b047ad..84c0ee54a5 100644 --- a/csharp/elasticbeanstalk/elasticbeanstalk-environment/cdk.json +++ b/csharp/elasticbeanstalk/elasticbeanstalk-environment/cdk.json @@ -2,5 +2,5 @@ "context": { "platform": "arn:aws:elasticbeanstalk:us-east-1::platform/Tomcat 8 with Java 8 running on 64bit Amazon Linux" }, - "app": "dotnet run -p src/ElasticbeanstalkEnvironment" + "app": "dotnet run --project src/ElasticbeanstalkEnvironment" } diff --git a/csharp/elasticbeanstalk/elasticbeanstalk-environment/src/ElasticbeanstalkEnvironment/ElasticbeanstalkEnvironment.csproj b/csharp/elasticbeanstalk/elasticbeanstalk-environment/src/ElasticbeanstalkEnvironment/ElasticbeanstalkEnvironment.csproj index 0fd3ad2da3..39e0a599e2 100644 --- a/csharp/elasticbeanstalk/elasticbeanstalk-environment/src/ElasticbeanstalkEnvironment/ElasticbeanstalkEnvironment.csproj +++ b/csharp/elasticbeanstalk/elasticbeanstalk-environment/src/ElasticbeanstalkEnvironment/ElasticbeanstalkEnvironment.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Major diff --git a/csharp/eventbridge-firehose-s3-cdk/src/src.csproj b/csharp/eventbridge-firehose-s3-cdk/src/src.csproj index 17e8f9efa1..9382e8f144 100644 --- a/csharp/eventbridge-firehose-s3-cdk/src/src.csproj +++ b/csharp/eventbridge-firehose-s3-cdk/src/src.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable enable latest diff --git a/csharp/lambda-cron/cdk.json b/csharp/lambda-cron/cdk.json index eebc1e9589..cc8895d2f1 100644 --- a/csharp/lambda-cron/cdk.json +++ b/csharp/lambda-cron/cdk.json @@ -1,5 +1,5 @@ { - "app": "dotnet run -p src/LambdaCron/LambdaCron.csproj", + "app": "dotnet run --project src/LambdaCron/LambdaCron.csproj", "context": { "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true, "@aws-cdk/core:enableStackNameDuplicates": "true", diff --git a/csharp/lambda-cron/src/LambdaCron.Tests/LambdaCron.Tests.csproj b/csharp/lambda-cron/src/LambdaCron.Tests/LambdaCron.Tests.csproj index 883d2d1d05..1d7096bab9 100644 --- a/csharp/lambda-cron/src/LambdaCron.Tests/LambdaCron.Tests.csproj +++ b/csharp/lambda-cron/src/LambdaCron.Tests/LambdaCron.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 false diff --git a/csharp/lambda-cron/src/LambdaCron/LambdaCron.csproj b/csharp/lambda-cron/src/LambdaCron/LambdaCron.csproj index dce6497a61..99007edd94 100644 --- a/csharp/lambda-cron/src/LambdaCron/LambdaCron.csproj +++ b/csharp/lambda-cron/src/LambdaCron/LambdaCron.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Major diff --git a/csharp/my-widget-service/cdk.json b/csharp/my-widget-service/cdk.json index 326874906a..f6ac408ec1 100644 --- a/csharp/my-widget-service/cdk.json +++ b/csharp/my-widget-service/cdk.json @@ -1,3 +1,3 @@ { - "app": "dotnet src/MyWidgetService/bin/Debug/net6.0/MyWidgetService.dll" + "app": "dotnet src/MyWidgetService/bin/Debug/net8.0/MyWidgetService.dll" } diff --git a/csharp/my-widget-service/src/MyWidgetService/MyWidgetService.csproj b/csharp/my-widget-service/src/MyWidgetService/MyWidgetService.csproj index ee245af932..9e7e4acc53 100644 --- a/csharp/my-widget-service/src/MyWidgetService/MyWidgetService.csproj +++ b/csharp/my-widget-service/src/MyWidgetService/MyWidgetService.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Major diff --git a/csharp/random-writer/src/RandomWriter/RandomWriter.csproj b/csharp/random-writer/src/RandomWriter/RandomWriter.csproj index 0be4a59c41..1a98348fbf 100644 --- a/csharp/random-writer/src/RandomWriter/RandomWriter.csproj +++ b/csharp/random-writer/src/RandomWriter/RandomWriter.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Major diff --git a/csharp/static-site/cdk.json b/csharp/static-site/cdk.json index 1f30826d9a..20ad05e4a7 100644 --- a/csharp/static-site/cdk.json +++ b/csharp/static-site/cdk.json @@ -3,5 +3,5 @@ "domain": "mystaticsite.com", "subdomain": "www" }, - "app": "dotnet run -p src/StaticSite/StaticSite.csproj" + "app": "dotnet run --project src/StaticSite/StaticSite.csproj" } diff --git a/csharp/static-site/src/StaticSite/StaticSite.csproj b/csharp/static-site/src/StaticSite/StaticSite.csproj index 0fd3ad2da3..39e0a599e2 100644 --- a/csharp/static-site/src/StaticSite/StaticSite.csproj +++ b/csharp/static-site/src/StaticSite/StaticSite.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Major diff --git a/csharp/stepfunctions-job-poller/cdk.json b/csharp/stepfunctions-job-poller/cdk.json index 15399d264c..6039a70be4 100644 --- a/csharp/stepfunctions-job-poller/cdk.json +++ b/csharp/stepfunctions-job-poller/cdk.json @@ -1,3 +1,3 @@ { - "app": "dotnet run -p src/StepfunctionsJobPoller/StepfunctionsJobPoller.csproj" + "app": "dotnet run --project src/StepfunctionsJobPoller/StepfunctionsJobPoller.csproj" } diff --git a/csharp/stepfunctions-job-poller/src/StepfunctionsJobPoller/StepfunctionsJobPoller.csproj b/csharp/stepfunctions-job-poller/src/StepfunctionsJobPoller/StepfunctionsJobPoller.csproj index 0fd3ad2da3..39e0a599e2 100644 --- a/csharp/stepfunctions-job-poller/src/StepfunctionsJobPoller/StepfunctionsJobPoller.csproj +++ b/csharp/stepfunctions-job-poller/src/StepfunctionsJobPoller/StepfunctionsJobPoller.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Major diff --git a/go/httpapi-lambda/httpapi-lambda_test.go b/go/httpapi-lambda/httpapi-lambda_test.go index 9339f5f8ef..195f5a21bd 100644 --- a/go/httpapi-lambda/httpapi-lambda_test.go +++ b/go/httpapi-lambda/httpapi-lambda_test.go @@ -16,7 +16,7 @@ func TestHttpapiLambdaStack(t *testing.T) { stack := NewHttpapiLambdaStack(app, "MyStack", nil) // THEN - template := assertions.Template_FromStack(stack) + template := assertions.Template_FromStack(stack, nil) template.HasResourceProperties(jsii.String("AWS::ApiGatewayV2::Api"), map[string]interface{}{}) diff --git a/scripts/build-toolkit/.gitignore b/scripts/build-toolkit/.gitignore new file mode 100644 index 0000000000..1a9d628c7f --- /dev/null +++ b/scripts/build-toolkit/.gitignore @@ -0,0 +1,4 @@ +node_modules +dist +package-lock.json +*.js.map diff --git a/scripts/build-toolkit/README.md b/scripts/build-toolkit/README.md new file mode 100644 index 0000000000..f7b4c33214 --- /dev/null +++ b/scripts/build-toolkit/README.md @@ -0,0 +1,113 @@ +# build-toolkit + +TypeScript build runner for all CDK example projects using the [@aws-cdk/toolkit-lib](https://www.npmjs.com/package/@aws-cdk/toolkit-lib) for programmatic synthesis. Replaces the bash-based `build-*.sh` scripts with structured output and message capture. + +## Supported Languages + +- **TypeScript** - npm/yarn install → tsc build → jest test → synth +- **Python** - pip install in venv → synth (venv cleaned up after) +- **Java** - mvn compile → mvn test → synth +- **Go** - go build → go test → synth +- **C#/.NET** - dotnet build → synth + +## What it does + +For each CDK project discovered under the target directory: + +1. Detects the language from project markers (package.json, requirements.txt, pom.xml, go.mod, *.csproj) +2. Runs the language-appropriate build pipeline +3. Runs programmatic `cdk synth` via `@aws-cdk/toolkit-lib` with a custom `IIoHost` that captures all warnings, deprecations, and errors +4. Projects with a `DO_NOT_AUTOTEST` file are skipped + +## Usage + +```bash +cd scripts/build-toolkit +npm install + +# Build ALL languages from repo root +npx tsx src/index.ts ../.. + +# Build only one language +npx tsx src/index.ts ../.. --language typescript +npx tsx src/index.ts ../.. --language python + +# With JSON report and custom concurrency +npx tsx src/index.ts ../.. --concurrency 4 --output /tmp/build-report.json + +# Or point at a specific language directory +npx tsx src/index.ts ../../typescript +``` + +## CLI Options + +| Option | Description | Default | +|--------|-------------|---------| +| `` | Root directory to scan for CDK projects (required) | - | +| `--language ` | Filter to one language: typescript, python, java, go, csharp | _(all)_ | +| `--concurrency N` | Max parallel builds | `os.cpus().length / 2` | +| `--output ` | Write JSON report to file | _(none, console only)_ | + +## Output + +### Console + +Live progress with emoji status per project as they complete: + +``` +Found 240 projects (230 buildable, 10 skipped) +Languages: typescript: 88, python: 78, java: 31, go: 25, csharp: 18 +Concurrency: 8 + +⏭️ typescript/static-site (DO_NOT_AUTOTEST) +✅ python/lambda-cron +✅ typescript/lambda-cron +✅ go/lambda-cron +✅ typescript/ecs/cluster (1 warning) +❌ java/broken-project (build failed) + +============================== +BUILD SUMMARY +============================== +Total: 240 (✅ 225 succeeded, ❌ 5 failed, ⏭️ 10 skipped) +Duration: 342.1s + +--- Warnings --- +⚠️ [warn at /MyFirstEcsCluster/MyFleet] desiredCapacity has been configured... + in: typescript/ecs/cluster +``` + +### JSON Report + +When `--output` is specified, writes a structured report with per-project steps, messages, timings, and language metadata. + +## How synth works + +Instead of shelling out to `cdk synth`, this tool uses the CDK Toolkit Library programmatically: + +1. Reads the `app` command from each project's `cdk.json` +2. For Python projects, prepends venv activation to the app command +3. Creates a `Toolkit` instance with a custom `IIoHost` that collects all messages +4. Calls `toolkit.fromCdkApp(appCommand)` then `toolkit.synth(source)` +5. Copies `scripts/fake.context.json` when no `cdk.context.json` exists + +The `IIoHost` captures messages at all levels (trace, debug, info, warn, error, result). + +## Project structure + +``` +scripts/build-toolkit/ + src/ + index.ts # CLI entry point, arg parsing + types.ts # TypeScript interfaces (Language, StepResult, etc.) + discover.ts # Find CDK projects, detect language, skip flags + runner.ts # Spawn child processes with timeout/capture + build.ts # Language-specific build pipelines + synth.ts # @aws-cdk/toolkit-lib synth with IIoHost + orchestrator.ts # Parallel execution with p-limit + report.ts # JSON report + console summary +``` + +## Exit code + +Exits `1` if any project fails, `0` if all succeed (skipped projects don't count as failures). diff --git a/scripts/build-toolkit/package.json b/scripts/build-toolkit/package.json new file mode 100644 index 0000000000..71c588ec58 --- /dev/null +++ b/scripts/build-toolkit/package.json @@ -0,0 +1,19 @@ +{ + "name": "build-toolkit", + "version": "1.0.0", + "description": "CDK Toolkit Library build runner for all TypeScript CDK projects", + "main": "dist/index.js", + "scripts": { + "build": "tsc", + "start": "tsx src/index.ts" + }, + "dependencies": { + "@aws-cdk/toolkit-lib": "^1.21.0", + "p-limit": "^3.1.0" + }, + "devDependencies": { + "@types/node": "^22.0.0", + "tsx": "^4.7.1", + "typescript": "~5.9.3" + } +} diff --git a/scripts/build-toolkit/src/build.ts b/scripts/build-toolkit/src/build.ts new file mode 100644 index 0000000000..b9b43fa156 --- /dev/null +++ b/scripts/build-toolkit/src/build.ts @@ -0,0 +1,82 @@ +import { access } from 'node:fs/promises'; +import { join } from 'node:path'; +import { runStep } from './runner'; +import { StepResult, Language } from './types'; + +async function exists(p: string): Promise { + try { await access(p); return true; } catch { return false; } +} + +async function buildTypescript(dir: string): Promise { + const steps: StepResult[] = []; + const hasYarnLock = await exists(join(dir, 'yarn.lock')); + const hasPkgLock = await exists(join(dir, 'package-lock.json')); + + let installResult: StepResult; + if (hasYarnLock) { + installResult = await runStep('install', 'yarn', ['install', '--frozen-lockfile', '--mutex', 'network'], dir); + } else if (hasPkgLock) { + installResult = await runStep('install', 'npm', ['ci'], dir); + } else { + installResult = await runStep('install', 'yarn', ['install', '--mutex', 'network'], dir); + } + steps.push(installResult); + if (!installResult.success) return steps; + + const buildResult = hasYarnLock + ? await runStep('build', 'yarn', ['build'], dir) + : await runStep('build', 'npm', ['run', 'build'], dir); + steps.push(buildResult); + if (!buildResult.success) return steps; + + steps.push(await runStep('test', 'npm', ['run', '--if-present', 'test'], dir)); + return steps; +} + +async function buildPython(dir: string): Promise { + const steps: StepResult[] = []; + // Create venv, install deps + const install = await runStep('install', 'bash', ['-c', + 'python3 -m venv .venv && source .venv/bin/activate && pip install -q -r requirements.txt' + ], dir); + steps.push(install); + return steps; // Python has no compile/test step in the existing scripts +} + +async function buildJava(dir: string): Promise { + const steps: StepResult[] = []; + const build = await runStep('build', 'mvn', ['-q', 'compile'], dir); + steps.push(build); + if (!build.success) return steps; + + steps.push(await runStep('test', 'mvn', ['-q', 'test'], dir)); + return steps; +} + +async function buildGo(dir: string): Promise { + const steps: StepResult[] = []; + const build = await runStep('build', 'go', ['build'], dir); + steps.push(build); + if (!build.success) return steps; + + steps.push(await runStep('test', 'go', ['test', './...'], dir)); + return steps; +} + +async function buildCsharp(dir: string): Promise { + const steps: StepResult[] = []; + const build = await runStep('build', 'dotnet', ['build', 'src'], dir); + steps.push(build); + return steps; // C# build script doesn't run tests separately +} + +export async function buildProject(dir: string, language: Language): Promise { + switch (language) { + case 'typescript': return buildTypescript(dir); + case 'python': return buildPython(dir); + case 'java': return buildJava(dir); + case 'go': return buildGo(dir); + case 'csharp': return buildCsharp(dir); + default: return [{ name: 'build', success: false, durationMs: 0, output: `Unsupported language: ${language}` }]; + } +} diff --git a/scripts/build-toolkit/src/discover.ts b/scripts/build-toolkit/src/discover.ts new file mode 100644 index 0000000000..3f63d497f8 --- /dev/null +++ b/scripts/build-toolkit/src/discover.ts @@ -0,0 +1,59 @@ +import { readdir, access } from 'node:fs/promises'; +import { join, relative, resolve } from 'node:path'; +import { DiscoveredProject, Language } from './types'; + +const IGNORE_DIRS = new Set(['node_modules', 'cdk.out', '.git', 'dist', '.venv', 'target']); + +async function exists(p: string): Promise { + try { await access(p); return true; } catch { return false; } +} + +async function detectLanguage(dir: string): Promise { + if (await exists(join(dir, 'package.json'))) return 'typescript'; + if (await exists(join(dir, 'requirements.txt'))) return 'python'; + if (await exists(join(dir, 'pom.xml'))) return 'java'; + if (await exists(join(dir, 'go.mod'))) return 'go'; + // C# - check for .sln or .csproj in src/ + const entries = await readdir(dir).catch(() => [] as string[]); + if (entries.some(e => e.endsWith('.sln'))) return 'csharp'; + const srcEntries = await readdir(join(dir, 'src')).catch(() => [] as string[]); + if (srcEntries.some(e => e.endsWith('.csproj') || e.endsWith('.sln'))) return 'csharp'; + return 'unknown'; +} + +async function findCdkJsons(dir: string, results: string[]): Promise { + const entries = await readdir(dir, { withFileTypes: true }); + for (const entry of entries) { + if (!entry.isDirectory() || IGNORE_DIRS.has(entry.name)) continue; + const full = join(dir, entry.name); + if (await exists(join(full, 'cdk.json'))) { + results.push(full); + } + await findCdkJsons(full, results); + } +} + +export async function discoverProjects(rootDir: string, filterLang?: Language): Promise { + const root = resolve(rootDir); + const dirs: string[] = []; + await findCdkJsons(root, dirs); + dirs.sort(); + + const projects: DiscoveredProject[] = []; + for (const dir of dirs) { + const language = await detectLanguage(dir); + if (filterLang && language !== filterLang) continue; + + const name = relative(resolve(root, '..'), dir); + const hasSkip = await exists(join(dir, 'DO_NOT_AUTOTEST')); + + if (hasSkip) { + projects.push({ name, path: dir, language, skip: true, skipReason: 'DO_NOT_AUTOTEST' }); + } else if (language === 'unknown') { + projects.push({ name, path: dir, language, skip: true, skipReason: 'unknown language' }); + } else { + projects.push({ name, path: dir, language, skip: false }); + } + } + return projects; +} diff --git a/scripts/build-toolkit/src/index.ts b/scripts/build-toolkit/src/index.ts new file mode 100644 index 0000000000..f604f24401 --- /dev/null +++ b/scripts/build-toolkit/src/index.ts @@ -0,0 +1,62 @@ +#!/usr/bin/env node +import { cpus } from 'node:os'; +import { resolve } from 'node:path'; +import { buildAll } from './orchestrator'; +import { writeJsonReport, printSummary } from './report'; +import { Language } from './types'; + +const LANGUAGES: Language[] = ['typescript', 'python', 'java', 'go', 'csharp']; + +function parseArgs(argv: string[]) { + const args = argv.slice(2); + let rootDir = ''; + let concurrency = Math.max(1, Math.floor(cpus().length / 2)); + let output = ''; + let language: Language | undefined; + + for (let i = 0; i < args.length; i++) { + if (args[i] === '--concurrency' && args[i + 1]) { + concurrency = parseInt(args[++i], 10); + } else if (args[i] === '--output' && args[i + 1]) { + output = args[++i]; + } else if (args[i] === '--language' && args[i + 1]) { + const lang = args[++i] as Language; + if (!LANGUAGES.includes(lang)) { + console.error(`Invalid language: ${lang}. Valid: ${LANGUAGES.join(', ')}`); + process.exit(1); + } + language = lang; + } else if (!args[i].startsWith('-')) { + rootDir = args[i]; + } + } + + if (!rootDir) { + console.error('Usage: build-toolkit [--language typescript|python|java|go|csharp] [--concurrency N] [--output report.json]'); + console.error('\n Root directory to scan (e.g. "." for all languages, or "typescript" for one)'); + process.exit(1); + } + + return { rootDir: resolve(rootDir), concurrency, output: output ? resolve(output) : '', language }; +} + +async function main() { + const { rootDir, concurrency, output, language } = parseArgs(process.argv); + + const langLabel = language || 'all languages'; + console.log(`Building CDK projects (${langLabel}) in: ${rootDir}`); + const report = await buildAll(rootDir, concurrency, language); + + printSummary(report); + + if (output) { + await writeJsonReport(report, output); + } + + process.exit(report.summary.failed > 0 ? 1 : 0); +} + +main().catch((err) => { + console.error('Fatal:', err); + process.exit(1); +}); diff --git a/scripts/build-toolkit/src/orchestrator.ts b/scripts/build-toolkit/src/orchestrator.ts new file mode 100644 index 0000000000..d7d9d48f18 --- /dev/null +++ b/scripts/build-toolkit/src/orchestrator.ts @@ -0,0 +1,91 @@ +import pLimit from 'p-limit'; +import { discoverProjects } from './discover'; +import { buildProject } from './build'; +import { synthProject } from './synth'; +import { ProjectResult, BuildReport, DiscoveredProject, Language } from './types'; + +async function processProject(project: DiscoveredProject): Promise { + const start = Date.now(); + + if (project.skip) { + return { + name: project.name, path: project.path, language: project.language, + status: 'skipped', steps: [], messages: [], durationMs: 0, + }; + } + + const steps = await buildProject(project.path, project.language); + const buildFailed = steps.some((s) => !s.success); + + if (buildFailed) { + const failedStep = steps.find((s) => !s.success)!; + console.log(`❌ ${project.name} (${failedStep.name} failed)`); + return { + name: project.name, path: project.path, language: project.language, + status: 'failed', steps, messages: [], durationMs: Date.now() - start, + }; + } + + const { step: synthStep, messages } = await synthProject(project.path, project.language); + steps.push(synthStep); + + const status = synthStep.success ? 'success' : 'failed'; + const warnCount = messages.filter((m) => m.level === 'warning' || m.level === 'warn').length; + const icon = status === 'success' ? '✅' : '❌'; + const suffix = warnCount > 0 ? ` (${warnCount} warning${warnCount > 1 ? 's' : ''})` : ''; + console.log(`${icon} ${project.name}${suffix}`); + + return { + name: project.name, path: project.path, language: project.language, + status, steps, messages, durationMs: Date.now() - start, + }; +} + +export async function buildAll(rootDir: string, concurrency: number, filterLang?: Language): Promise { + const start = Date.now(); + const projects = await discoverProjects(rootDir, filterLang); + + const skipped = projects.filter((p) => p.skip); + const buildable = projects.filter((p) => !p.skip); + + // Group by language for display + const langCounts = new Map(); + for (const p of projects) { + langCounts.set(p.language, (langCounts.get(p.language) || 0) + 1); + } + const langSummary = [...langCounts.entries()].map(([l, c]) => `${l}: ${c}`).join(', '); + + console.log(`Found ${projects.length} projects (${buildable.length} buildable, ${skipped.length} skipped)`); + console.log(`Languages: ${langSummary}`); + console.log(`Concurrency: ${concurrency}\n`); + + for (const p of skipped) { + console.log(`⏭️ ${p.name} (${p.skipReason})`); + } + + const limit = pLimit(concurrency); + const results = await Promise.all( + buildable.map((p) => limit(() => processProject(p))) + ); + + const allResults: ProjectResult[] = [ + ...skipped.map((p): ProjectResult => ({ + name: p.name, path: p.path, language: p.language, + status: 'skipped', steps: [], messages: [], durationMs: 0, + })), + ...results, + ]; + + return { + timestamp: new Date().toISOString(), + durationMs: Date.now() - start, + concurrency, + summary: { + total: allResults.length, + success: results.filter((r) => r.status === 'success').length, + failed: results.filter((r) => r.status === 'failed').length, + skipped: skipped.length, + }, + projects: allResults.sort((a, b) => a.name.localeCompare(b.name)), + }; +} diff --git a/scripts/build-toolkit/src/report.ts b/scripts/build-toolkit/src/report.ts new file mode 100644 index 0000000000..560ceb5fb5 --- /dev/null +++ b/scripts/build-toolkit/src/report.ts @@ -0,0 +1,53 @@ +import { writeFile } from 'node:fs/promises'; +import { BuildReport } from './types'; + +export async function writeJsonReport(report: BuildReport, outputPath: string): Promise { + await writeFile(outputPath, JSON.stringify(report, null, 2) + '\n'); + console.log(`\nReport written to ${outputPath}`); +} + +export function printSummary(report: BuildReport): void { + const { summary } = report; + const duration = (report.durationMs / 1000).toFixed(1); + + console.log('\n=============================='); + console.log('BUILD SUMMARY'); + console.log('=============================='); + console.log(`Total: ${summary.total} (✅ ${summary.success} succeeded, ❌ ${summary.failed} failed, ⏭️ ${summary.skipped} skipped)`); + console.log(`Duration: ${duration}s`); + + // Collect unique warnings across all projects + const warnings = new Map(); + for (const p of report.projects) { + for (const m of p.messages) { + if (m.level === 'warning' || m.level === 'warn') { + const key = m.message.slice(0, 120); + if (!warnings.has(key)) warnings.set(key, []); + warnings.get(key)!.push(p.name); + } + } + } + + if (warnings.size > 0) { + console.log('\n--- Warnings ---'); + for (const [msg, projects] of warnings) { + console.log(`⚠️ ${msg}`); + console.log(` in: ${projects.join(', ')}`); + } + } + + // Failed projects with details + const failed = report.projects.filter((p) => p.status === 'failed'); + if (failed.length > 0) { + console.log('\n--- Failed Projects ---'); + for (const p of failed) { + const failedStep = p.steps.find((s) => !s.success); + console.log(`❌ ${p.name}`); + if (failedStep) { + console.log(` Step: ${failedStep.name}`); + const lastLines = failedStep.output.split('\n').slice(-5).join('\n'); + if (lastLines.trim()) console.log(` ${lastLines.trim()}`); + } + } + } +} diff --git a/scripts/build-toolkit/src/runner.ts b/scripts/build-toolkit/src/runner.ts new file mode 100644 index 0000000000..59b24fc85e --- /dev/null +++ b/scripts/build-toolkit/src/runner.ts @@ -0,0 +1,36 @@ +import { spawn } from 'node:child_process'; +import { StepResult, StepName } from './types'; + +export function runStep(name: StepName, cmd: string, args: string[], cwd: string, timeoutMs = 300_000): Promise { + const start = Date.now(); + return new Promise((resolve) => { + const proc = spawn(cmd, args, { + cwd, + stdio: ['ignore', 'pipe', 'pipe'], + timeout: timeoutMs, + env: { ...process.env }, + }); + + const chunks: Buffer[] = []; + proc.stdout.on('data', (d) => chunks.push(d)); + proc.stderr.on('data', (d) => chunks.push(d)); + + proc.on('close', (code) => { + resolve({ + name, + success: code === 0, + durationMs: Date.now() - start, + output: Buffer.concat(chunks).toString().slice(-8000), // keep last 8k + }); + }); + + proc.on('error', (err) => { + resolve({ + name, + success: false, + durationMs: Date.now() - start, + output: err.message, + }); + }); + }); +} diff --git a/scripts/build-toolkit/src/synth.ts b/scripts/build-toolkit/src/synth.ts new file mode 100644 index 0000000000..217452edc9 --- /dev/null +++ b/scripts/build-toolkit/src/synth.ts @@ -0,0 +1,79 @@ +import { readFile, copyFile, unlink, access } from 'node:fs/promises'; +import { join, resolve } from 'node:path'; +import { Toolkit } from '@aws-cdk/toolkit-lib'; +import { StepResult, MessageRecord, Language } from './types'; + +const FAKE_CONTEXT = resolve(__dirname, '../../fake.context.json'); + +async function exists(p: string): Promise { + try { await access(p); return true; } catch { return false; } +} + +export async function synthProject(projectDir: string, language: Language): Promise<{ step: StepResult; messages: MessageRecord[] }> { + const messages: MessageRecord[] = []; + const start = Date.now(); + let copiedFakeCtx = false; + const ctxPath = join(projectDir, 'cdk.context.json'); + + try { + if (!await exists(ctxPath)) { + await copyFile(FAKE_CONTEXT, ctxPath); + copiedFakeCtx = true; + } + + const cdkJson = JSON.parse(await readFile(join(projectDir, 'cdk.json'), 'utf8')); + let appCmd: string = cdkJson.app; + if (!appCmd) throw new Error('No "app" field in cdk.json'); + + // Python projects need venv activation prepended + if (language === 'python' && await exists(join(projectDir, '.venv'))) { + appCmd = `bash -c "source .venv/bin/activate && ${appCmd}"`; + } + + const toolkit = new Toolkit({ + ioHost: { + notify: async (msg) => { + messages.push({ + level: msg.level, + message: msg.message, + timestamp: new Date().toISOString(), + code: (msg as any).code, + }); + }, + requestResponse: async (msg) => msg.defaultResponse, + }, + }); + + const savedEnv = { ...process.env }; + process.env.AWS_DEFAULT_REGION = process.env.AWS_DEFAULT_REGION || 'us-east-1'; + process.env.CDK_DEFAULT_REGION = process.env.CDK_DEFAULT_REGION || 'us-east-1'; + process.env.CDK_DEFAULT_ACCOUNT = process.env.CDK_DEFAULT_ACCOUNT || '123456789012'; + + try { + const source = await toolkit.fromCdkApp(appCmd, { workingDirectory: projectDir }); + await toolkit.synth(source, { validateStacks: false }); + } finally { + process.env = savedEnv; + } + + return { + step: { name: 'synth', success: true, durationMs: Date.now() - start, output: '' }, + messages, + }; + } catch (err: any) { + messages.push({ level: 'error', message: err.message, timestamp: new Date().toISOString() }); + return { + step: { name: 'synth', success: false, durationMs: Date.now() - start, output: err.message }, + messages, + }; + } finally { + if (copiedFakeCtx) { + await unlink(ctxPath).catch(() => {}); + } + // Clean up Python venv after synth (matching bash script behavior) + if (language === 'python') { + const { rm } = await import('node:fs/promises'); + await rm(join(projectDir, '.venv'), { recursive: true, force: true }).catch(() => {}); + } + } +} diff --git a/scripts/build-toolkit/src/types.ts b/scripts/build-toolkit/src/types.ts new file mode 100644 index 0000000000..d4b827e60f --- /dev/null +++ b/scripts/build-toolkit/src/types.ts @@ -0,0 +1,43 @@ +export type StepName = 'install' | 'build' | 'test' | 'synth'; +export type ProjectStatus = 'success' | 'failed' | 'skipped'; +export type Language = 'typescript' | 'python' | 'java' | 'go' | 'csharp' | 'unknown'; + +export interface StepResult { + name: StepName; + success: boolean; + durationMs: number; + output: string; +} + +export interface MessageRecord { + level: string; + message: string; + timestamp: string; + code?: string; +} + +export interface ProjectResult { + name: string; + path: string; + language: Language; + status: ProjectStatus; + steps: StepResult[]; + messages: MessageRecord[]; + durationMs: number; +} + +export interface BuildReport { + timestamp: string; + durationMs: number; + concurrency: number; + summary: { total: number; success: number; failed: number; skipped: number }; + projects: ProjectResult[]; +} + +export interface DiscoveredProject { + name: string; + path: string; + language: Language; + skip: boolean; + skipReason?: string; +} diff --git a/scripts/build-toolkit/tsconfig.json b/scripts/build-toolkit/tsconfig.json new file mode 100644 index 0000000000..78e211c59e --- /dev/null +++ b/scripts/build-toolkit/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "commonjs", + "lib": ["ES2022"], + "declaration": true, + "outDir": "./dist", + "rootDir": "./src", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "sourceMap": true + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +} diff --git a/typescript/codepipeline-build-deploy/lib/codepipeline-build-deploy-stack.ts b/typescript/codepipeline-build-deploy/lib/codepipeline-build-deploy-stack.ts index 1e062b3d1a..5660d11e14 100644 --- a/typescript/codepipeline-build-deploy/lib/codepipeline-build-deploy-stack.ts +++ b/typescript/codepipeline-build-deploy/lib/codepipeline-build-deploy-stack.ts @@ -289,6 +289,7 @@ export class CodepipelineBuildDeployStack extends cdk.Stack { // Creates an AWS CodePipeline with source, build, and deploy stages new pipeline.Pipeline(this, "BuildDeployPipeline", { pipelineName: "ImageBuildDeployPipeline", + pipelineType: pipeline.PipelineType.V2, stages: [sourceStage, testStage, buildStage, deployStage], }); diff --git a/typescript/ddb/global-table-with-cmk/cdk.json b/typescript/ddb/global-table-with-cmk/cdk.json index 3298d1e3dd..8ba1e62dea 100644 --- a/typescript/ddb/global-table-with-cmk/cdk.json +++ b/typescript/ddb/global-table-with-cmk/cdk.json @@ -25,6 +25,7 @@ "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, "@aws-cdk/aws-iam:minimizePolicies": true, + "@aws-cdk/customresources:installLatestAwsSdkDefault": false, "@aws-cdk/core:target-partitions": [ "aws", "aws-cn" diff --git a/typescript/elasticbeanstalk/elasticbeanstalk-bg-pipeline/index.ts b/typescript/elasticbeanstalk/elasticbeanstalk-bg-pipeline/index.ts index 9673a65b4e..627d4c7a2e 100644 --- a/typescript/elasticbeanstalk/elasticbeanstalk-bg-pipeline/index.ts +++ b/typescript/elasticbeanstalk/elasticbeanstalk-bg-pipeline/index.ts @@ -24,7 +24,7 @@ export class CdkStack extends cdk.Stack { }); const handler = new lambda.Function(this, 'BlueGreenLambda', { - runtime: lambda.Runtime.PYTHON_3_6, + runtime: lambda.Runtime.PYTHON_3_12, code: lambda.Code.fromAsset('resources'), handler: 'blue_green.lambda_handler', environment: { @@ -38,7 +38,9 @@ export class CdkStack extends cdk.Stack { repositoryName: 'MyRepositoryName', }); - const pipeline = new cp.Pipeline(this, 'MyFirstPipeline'); + const pipeline = new cp.Pipeline(this, 'MyFirstPipeline', { + pipelineType: cp.PipelineType.V2, + }); const sourceStage = pipeline.addStage({ stageName: 'Source' diff --git a/typescript/lambda-api-ci/lib/ci-stack.ts b/typescript/lambda-api-ci/lib/ci-stack.ts index 2c116bcc81..1293efa8b8 100644 --- a/typescript/lambda-api-ci/lib/ci-stack.ts +++ b/typescript/lambda-api-ci/lib/ci-stack.ts @@ -2,7 +2,7 @@ import { CodeCommitSourceAction, CodeBuildAction } from "aws-cdk-lib/aws-codepip import { PolicyStatement } from "aws-cdk-lib/aws-iam" import { ArnFormat, Stack, StackProps } from "aws-cdk-lib" import { PipelineProject, LinuxBuildImage } from "aws-cdk-lib/aws-codebuild" -import { Artifact, Pipeline } from "aws-cdk-lib/aws-codepipeline" +import { Artifact, Pipeline, PipelineType } from "aws-cdk-lib/aws-codepipeline" import { Repository } from "aws-cdk-lib/aws-codecommit" import { Construct } from "constructs" import { lambdaApiStackName, lambdaFunctionName } from "../bin/lambda" @@ -15,7 +15,9 @@ export class CIStack extends Stack { constructor(scope: Construct, name: string, props: CIStackProps) { super(scope, name, props) - const pipeline = new Pipeline(this, "Pipeline", {}) + const pipeline = new Pipeline(this, "Pipeline", { + pipelineType: PipelineType.V2, + }) const repo = Repository.fromRepositoryName( this, diff --git a/typescript/s3-sns-lambda-chain/cdk.json b/typescript/s3-sns-lambda-chain/cdk.json index 99f2e21e93..9335f5ec85 100644 --- a/typescript/s3-sns-lambda-chain/cdk.json +++ b/typescript/s3-sns-lambda-chain/cdk.json @@ -1,3 +1,6 @@ { - "app": "npx ts-node --prefer-ts-exts bin/s3-sns-sqs-lambda-chain.ts" + "app": "npx ts-node --prefer-ts-exts bin/s3-sns-sqs-lambda-chain.ts", + "context": { + "@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": true + } }