pipelines: Supporting a feature branch development process
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
Multi-branch feature development and pipelines is a common development practice. However, this functionality isn't built into CDK Pipeline natively. A [blog post about a potential solution published last year](https://aws.amazon.com/blogs/devops/multi-branch-pipeline-management-and-infrastructure-deployment-using-aws-cdk-pipelines/) describes a possible workaround, with a few serious barriers to adoption:
1. It's incompatible with Github connections, which do not trigger event bridge notifications
2. It's requires deploying a variety of custom resources for each branch, including 2 lambda functions that need to be access controlled, updated and maintained.
Given CDK Pipeline is intended to enable "painless continuous delivery of AWS CDK applications", it seems like supporting more than the most basic deployment process should be part of it's scope.
### Use Case
Supporting a [feature branch](https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow) development process, without lot's of additional setup.
### Proposed Solution
Update the branch parameter [aws-cdk-lib/pipelines/lib/codepipeline/codepipeline-source](https://github.com/aws/aws-cdk/blob/40b58fa64fb16f5debf69b1ade14c817d44f50b2/packages/%40aws-cdk/pipelines/lib/codepipeline/codepipeline-source.ts#L420) to allow the branch parameter to be either a string or a regular expression. If it's a regular expression, only trigger the pipeline if the branch matches the pattern.
The ergonomics on a code pipeline might look like:
```
new CodePipeline(this, 'FeaturePipeline', {
pipelineName: 'FeaturePipeline',
synth: new CodeBuildStep('Synth', {
input: CodePipelineSource.connection(
'some-repo',
/feat\-/, // branch pattern,
{
connectionArn: `arn:aws:codestar-connections:region:acccount:connection/some connection`
}
),
commands: [
// ....
]
})
})
```
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [X] This feature might incur a breaking change
### CDK version used
2.83.1
### Environment details (OS name and version, etc.)
Mac OS latest
Contributor guide
Research direction
Start with aws-cdk-lib/pipelines/lib/codepipeline/codepipeline-source.ts at the branch parameter referenced in the issue, then review the linked multi-branch pipeline discussion and existing connection behavior. Done means the source accepts a string or regular expression and triggers the pipeline only for matching branches, while the issue's proposed CodePipelineSource.connection usage is supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, github, typescript
- Domain
- ci-cd, cloud, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100