(aws-cdk-lib/pipelines): CDKPipelines source / input change from v1 to v2 doesn't allow 5 sources
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
Multiple teams have reported that migrating from CDK v1 to v2 when using CDKPipelines results in no longer being able to use 5 sources for CodeBuild. The symptom is that at synth time, they get a "Build/CodeBuild cannot have more than 5 input artifacts" error from the core CodeBuild service, which is a hard limit.
The approach of using additional_inputs for multiple sources is suggested in this GitHub issue:
https://github.com/aws/aws-cdk/issues/14493
but it's not quite what was previously allowed with the Source add action functionality.
### Expected Behavior
Minimal changes to the CDKPipeline in the v1 to v2 upgrade, or prescriptive guidance of how to do so for pipelines that have more than one input.
### Current Behavior
After upgrading to CDK v2 and attempting to configure the same multi-source Source actions via the CodeBuild additional_inputs list, the symptom is that at synth time, they get a "Build/CodeBuild cannot have more than 5 input artifacts" error from the core CodeBuild service, which is a hard limit.
### Reproduction Steps
Steps to reproduce:
1. Start with a CDK v1 app using CDKPipelines and 5 sources (via source.add_action against the CDKPipeline's Source stage).
2. Upgrade that app to CDK v2, which requires using the CodeBuild additional_inputs mechanism inherited from the ShellStep interface.
3. At synth time, you'll get the error "Build/CodeBuild cannot have more than 5 input artifacts" because the CodeBuild provisioning requires an input parameter, which is added to the 5 additional inputs that were originally in the v1 Source action.
### Possible Solution
I *think* this may be due to the removal of the Source stage entirely in the move to v2, subsequent confusion between ShellSteps and CodeBuild steps, and the lack of documentation / examples for / validation that a CodeBuild step can't have more than 5 inputs (because the CodeBuild service itself has that hard limit.
My requested changes would be to
1. Allow a CodeBuild step to take more than one input natively, rather than relying on the additional_input structure inherited from ShellStep, or enforce only 4 additional inputs since the CodeBuild step requires one input in its required parameter list.
2. Update the CDKPipelines documentation to make this limit more clear.
3. Create examples that show how to use CDKPipelines when building a project that needs more than one input source.
What #3 looks like depends on whether If #1 is possible. If #1 is not possible, is our prescriptive guidance to configure one or more ShellSteps before the CodeBuild step to accumulate inputs first, then build?
Either way, we can still do #2 and #3 to improve the developer experience. Thanks!
### Additional Information/Context
Need to ensure that whatever change is made whether the pipeline can be triggered by a change in any of the multiple inputs, rather than just the one specified in the required input parameter.
### CDK CLI Version
2.93.0
### Framework Version
_No response_
### Node.js Version
16.20.0
### OS
Linux
### Language
Python
### Language Version
Python version 3.9.16
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.