Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codepipeline: Add Branches and File Paths to CodePipeline pipeline GitPushFilter configuration #29124

Closed
2 tasks
einstein-aws opened this issue Feb 15, 2024 · 18 comments · Fixed by #29127
Closed
2 tasks
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline @aws-cdk/pipelines CDK Pipelines library effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1

Comments

@einstein-aws
Copy link

Describe the feature

Currently, as it seems, only tag-based filters are available (or exposed) in CodePipeline pipeline GitPushFilter configuration via tagsExcludes and tagsIncludes parameters. However, both Branches and FilePaths options exist in CloudFormation spec https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-gitpushfilter.html Can you please add the two missing configuration parameters? Thanks!

Use Case

Branch-based pipeline trigger.

Proposed Solution

Add branchesExclude, branchesInclude, filePathsExclude and filePathsInclude parameters to match CloudFormation spec.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

v2.128.0 (TypeScript)

Environment details (OS name and version, etc.)

MacOS Sonoma 14.3.1

@einstein-aws einstein-aws added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Feb 15, 2024
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Feb 15, 2024
@go-to-k
Copy link
Contributor

go-to-k commented Feb 16, 2024

I will take this issue.

@vumdao
Copy link

vumdao commented Feb 16, 2024

@go-to-k Can you please update for packages/aws-cdk-lib/pipelines/lib/codepipeline/codepipeline.ts either? Thanks.

@go-to-k
Copy link
Contributor

go-to-k commented Feb 16, 2024

@vumdao

The pipelines module already seems to be quite different in structure from aws-codepipeline. It might be better if you could create a separate issue with specific use cases.
In the meantime, we can pass existing pipelines to props, so that might help us meet the requirements even before we have to deal with that.

https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/pipelines/README.md#using-an-existing-aws-codepipeline

@pahud pahud changed the title aws-cdk-lib/aws-codepipeline: Add Branches and File Paths to CodePipeline pipeline GitPushFilter configuration codepipeline: Add Branches and File Paths to CodePipeline pipeline GitPushFilter configuration Feb 16, 2024
@github-actions github-actions bot added the @aws-cdk/aws-codepipeline Related to AWS CodePipeline label Feb 16, 2024
@pahud
Copy link
Contributor

pahud commented Feb 16, 2024

Awesome! Thank you for picking this up with a PR. @go-to-k

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Feb 16, 2024
@jmihalich
Copy link

+1 for adding this to the cdk CodePipeline construct. I've been waiting for this.

Joe

@mostafafarzaneh
Copy link

+1 for this feature. Is there any update?

@go-to-k
Copy link
Contributor

go-to-k commented Apr 17, 2024

The PR is awaiting review, so please be patient.

If the number of thumbs-up reactions (👍) to this issue is high, it will be given priority for review. So please do.

@github-actions github-actions bot added p1 and removed p2 labels May 19, 2024
Copy link

This issue has received a significant amount of attention so we are automatically upgrading its priority. A member of the community will see the re-prioritization and provide an update on the issue.

@mglubb
Copy link

mglubb commented May 28, 2024

For those still needing this, pending the PR being merged, you can use the cdk escape hatch. E.g.

const cfnPipeline = pipeline.node.defaultChild as CfnPipeline;
cfnPipeline.addPropertyOverride('Triggers', [
  {
    GitConfiguration: {
      Push: [
        {
          Branches: {
            Includes: ['main'],
          },
        },
      ],
      SourceActionName: 'MySourceName',
    },
    ProviderType: 'CodeStarSourceConnection',
  }
]);

@mergify mergify bot closed this as completed in #29127 Jun 3, 2024
mergify bot pushed a commit that referenced this issue Jun 3, 2024
…trigger (#29127)

### Issue # (if applicable)

Closes #29124

Related PR: #29128
Perhaps if one merges, the other will cause a conflict.

### Reason for this change

We would be good to trigger pipelines by GitPushFilter with branches and file paths.

- CFn docs
  - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-gitpushfilter.html
  - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-gitbranchfiltercriteria.html
  - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-gitfilepathfiltercriteria.html

### Description of changes

Add props:

- branchesExcludes
- branchesIncludes
- filePathsExcludes
- filePathsIncludes

### Description of how you validated changes

Both unit and integ tests.

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy link

github-actions bot commented Jun 3, 2024

⚠️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.

vdahlberg pushed a commit to vdahlberg/aws-cdk that referenced this issue Jun 10, 2024
…trigger (aws#29127)

### Issue # (if applicable)

Closes aws#29124

Related PR: aws#29128
Perhaps if one merges, the other will cause a conflict.

### Reason for this change

We would be good to trigger pipelines by GitPushFilter with branches and file paths.

- CFn docs
  - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-gitpushfilter.html
  - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-gitbranchfiltercriteria.html
  - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-gitfilepathfiltercriteria.html

### Description of changes

Add props:

- branchesExcludes
- branchesIncludes
- filePathsExcludes
- filePathsIncludes

### Description of how you validated changes

Both unit and integ tests.

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Leo10Gama pushed a commit to Leo10Gama/aws-cdk that referenced this issue Jun 11, 2024
…trigger (aws#29127)

### Issue # (if applicable)

Closes aws#29124

Related PR: aws#29128
Perhaps if one merges, the other will cause a conflict.

### Reason for this change

We would be good to trigger pipelines by GitPushFilter with branches and file paths.

- CFn docs
  - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-gitpushfilter.html
  - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-gitbranchfiltercriteria.html
  - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-gitfilepathfiltercriteria.html

### Description of changes

Add props:

- branchesExcludes
- branchesIncludes
- filePathsExcludes
- filePathsIncludes

### Description of how you validated changes

Both unit and integ tests.

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
mazyu36 pushed a commit to mazyu36/aws-cdk that referenced this issue Jun 22, 2024
…trigger (aws#29127)

### Issue # (if applicable)

Closes aws#29124

Related PR: aws#29128
Perhaps if one merges, the other will cause a conflict.

### Reason for this change

We would be good to trigger pipelines by GitPushFilter with branches and file paths.

- CFn docs
  - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-gitpushfilter.html
  - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-gitbranchfiltercriteria.html
  - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-gitfilepathfiltercriteria.html

### Description of changes

Add props:

- branchesExcludes
- branchesIncludes
- filePathsExcludes
- filePathsIncludes

### Description of how you validated changes

Both unit and integ tests.

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@wilhen01
Copy link
Contributor

Can we reopen this issue since the fix was reverted?

@dguisinger
Copy link

Can we reopen this issue since the fix was reverted?

@go-to-k see @wilhen01's message above. It looks like this change was reverted.

@go-to-k
Copy link
Contributor

go-to-k commented Aug 2, 2024

Perhaps the reopening can only be done by maintainers. Therefore, creating a new issue is good.

@wilhen01
Copy link
Contributor

wilhen01 commented Aug 2, 2024

Re-raised as #31009

@dguisinger
Copy link

Re-raised as #31009

@wilhen01 there appear to be a tangled mess of cross-referencing issues and pull requests I was digging through last night while trying to figure out how to get this to work on my project. It appears this was rejected because it didn't meet the standards of how the CDK team wants to do things, and there has been a draft pull request sitting out there since June 10th: #30516

However there has been no movement for 45 days

@wilhen01
Copy link
Contributor

wilhen01 commented Aug 2, 2024

Thanks @dguisinger - I've mentioned that in the new issue.

@jamierbower
Copy link

@mglubb Thanks for posting the work around using escape hatches.

I have tried implementing that fix, however when I try to deploy I am getting the following error: "Triggers for connections must reference a CodeStarSourceConnection action."

Am I right in thinking the value for "SourceActionName" should be the same as the "Name" property of the Source stage in my pipeline?

@moltar
Copy link
Contributor

moltar commented Sep 23, 2024

Am I right in thinking the value for "SourceActionName" should be the same as the "Name" property of the Source stage in my pipeline?

Omg, spent hours banging my head, but it was so simple. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline @aws-cdk/pipelines CDK Pipelines library effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.