CodeBuild PipelineProject LinuxBuildImage.STANDARD_6_0 somehow got mixed up with aws-cdk-lib.aws_codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
We have a .NET CDK project that handles deployment of CodePipleline/CodeBuild and has been working based on Amazon.CDK.Lib 2.94.0.
For our React application pipelines, the CodeBuild setup is like
```
this.Build = new PipelineProject(this, codeBuildName, new PipelineProjectProps
{
Environment = new BuildEnvironment
{
BuildImage = LinuxBuildImage.STANDARD_6_0,
ComputeType = ComputeType.MEDIUM
},
Description = $"{_props.ProductName} React CI CD {_props.Environment}",
ProjectName = codeBuildName,
Timeout = Duration.Minutes(10),
EnvironmentVariables = envVars,
Badge = false,
Cache = Cache.Local(LocalCacheMode.CUSTOM),
Role = this._props.CodebuildRole
});
```
Upon updating to CDK 2.130.0, attempting cdk list would result in strange error.
> PS C:\projects\dev-tools-cdk> cdk list
> Warning NETSDK1174: The abbreviation of -p for --project is deprecated. Please use --project.
>
> Unhandled exception. System.TypeInitializationException: The type initializer for 'Amazon.CDK.AWS.CodeBuild.LinuxBuildImage' threw an exception.
> ---> System.Exception: Of static property aws-cdk-lib.aws_codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM: Unable to serialize value as aws-cdk-lib.aws_codebuild.IBuildImage
> ├── ?? Failing value is undefined
> ?── ?? Failure reason(s):
> ?─ A value is required (type is non-optional)
> at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
> at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
> at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
> at Amazon.JSII.Runtime.Services.Client.StaticGet(StaticGetRequest request)
> at Amazon.JSII.Runtime.Services.Client.StaticGet(String fullyQualifiedName, String property)
> at Amazon.JSII.Runtime.Deputy.DeputyBase.<>c__DisplayClass8_0`1.b__0(IClient client)
> at Amazon.JSII.Runtime.Deputy.DeputyBase.GetPropertyCore[T](JsiiPropertyAttribute propertyAttribute, Func`2 getFunc)
> at Amazon.JSII.Runtime.Deputy.DeputyBase.GetStaticProperty[T](Type type, String propertyName)
> at Amazon.CDK.AWS.CodeBuild.LinuxBuildImage..cctor()
> --- End of inner exception stack trace ---
> at Amazon.CDK.AWS.CodeBuild.LinuxBuildImage.get_STANDARD_6_0()
> at DevToolsCdk.Constructs.ReactPipeline.Initialize() in C:\projects\dev-tools-cdk\src\DevToolsCdk\Constructs\ReactPipeline.cs:line 85
> at DevToolsCdk.Constructs.ReactPipeline..ctor(Construct scope, String id, ArtifactStore artifactStore, ReactPipelineProps props) in C:\projects\dev-tools-cdk\src\DevToolsCdk\Constructs\ReactPipeline.cs:line 48
> at DevToolsCdk.Stacks.EvoBuildStack.EstablishReactFrontEnd(ReactFrontEndConfig frontEndConfig) in C:\projects\dev-tools-cdk\src\DevToolsCdk\Stacks\EvoBuildStack.cs:line 229
> at DevToolsCdk.Stacks.EvoBuildStack..ctor(Construct scope, String id, EvoBuildConfig config, DevToolsStack sharedStack, DevToolsConfig sharedConfig, IStackProps props) in C:\projects\dev-tools-cdk\src\DevToolsCdk\Stacks\EvoBuildStack.cs:line 72
> at DevToolsCdk.Program.Main(String[] args) in C:\projects\dev-tools-cdk\src\DevToolsCdk\Program.cs:line 56
Why is there involvement with LinuxBuildImage.AMAZON_LINUX_2_ARM? Our definition is for STANDARD_6_0 (Ubuntu).
### Expected Behavior
CodeBuild continue to use LinuxBuildImage.STANDARD_6_0 like previously.
### Current Behavior
LinuxBuildImage.STANDARD_6_0 somehow ends up as LinuxBuildImage.AMAZON_LINUX_2_ARM and not properly defined under the covers?
### Reproduction Steps
1. Update from Amazon.CDK.Lib 2.94.0 to 2.130.0.
2. Build existing CDK project as per above code expectations.
3. run cdk list
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.130.0
### Framework Version
.NET 6.0
### Node.js Version
18.9.0
### OS
Windows 11
### Language
.NET
### Language Version
C# 10
### Other information
_No response_
Contributor guide
Research direction
Reproduce the failure with the .NET CDK project, comparing Amazon.CDK.Lib 2.94.0 and 2.130.0, then run cdk list and inspect LinuxBuildImage static initialization around STANDARD_6_0 and AMAZON_LINUX_2_ARM. Done means STANDARD_6_0 resolves successfully without the AMAZON_LINUX_2_ARM serialization error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, csharp, node.js, typescript
- Domain
- build-system, cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100