aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.59k stars 3.89k forks source link

(pipelines) CodeCommit CodePipelineSource gives no option to filter by path, making multiple separate pipelines in one monorepo impossible #20098

Closed lestephane closed 2 years ago

lestephane commented 2 years ago

Describe the feature

Make CodePipelineSource.codeCommit support path filters. You don't for GitHub, but then again, GitHub is not under your control, while CodeCommit most certainly is.

Use Case

I want to create multiple pipelines in a single infrastructure-as-code repository, and I want each pipeline to be triggered only when a specific file set has changed.

In the CDK Continuous Delivery RFC, a similar assumption is voiced, that there will be multiple pipelines:

Non-requirements/assumptions: ... There’s a one-to-one mapping between an app and a pipeline. We are not optimizing the experience for multiple apps per pipeline (although technically it should be possible to do it, but it’s not a use case we are focused on).

The simplest way to keep multiple pipelines under version control is to use one single CodeCommit repository. Unfortunately, If I setup 30 apps as 30 pipelines in one CodeCommit repository, and change one file that only affects one app, 30 pipelines will be trigged (with all the associated costs that it entails), only to determine that there is no changeset for 29 of them.

The only way to mitigate this is allow the specification of a path filter in the CodePipelineSource for CodeCommit repositories. I'm fully aware this is not supported by AWS at the moment.

What I'm hereby requesting is that there be a plan for CodeCommit based monorepos in CDK, otherwise I cannot in good conscience use it for my client. I checked the situation years ago, and thought filter paths would be available by now, especially for CodeCommit, a technology that you control.

Can you share anything that would somehow make a CodePipeline trigger only when a specific subset of files in CodeCommit is modified?

Proposed Solution

If this is possible by any roundabout way (using EventBridge or some such), please make an aws sample available.

Other Information

No response

Acknowledgements

CDK version used

2.21.1

Environment details (OS name and version, etc.)

Ubuntu 20.04

rix0rrr commented 2 years ago

What you are asking for is not supported by CodePipeline, and hence not by CDK.

You can probably achieve the same or a similar result by building a pipeline that is explicitly triggered by EventBridge or a CodeBuild project. I don't have example code for you on that, though.

rix0rrr commented 2 years ago

I have passed on your request to the CodePipeline team.

github-actions[bot] commented 2 years ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.