-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(codepipeline): GitPullRequestFilter
for pipeline trigger
#29128
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
/** | ||
* Event for trigger with pull request filter. | ||
*/ | ||
export enum GitPullRequestEvent { | ||
/** | ||
* OPEN | ||
*/ | ||
OPEN = 'OPEN', | ||
/** | ||
* UPDATED | ||
*/ | ||
UPDATED = 'UPDATED', | ||
/** | ||
* CLOSED | ||
*/ | ||
CLOSED = 'CLOSED', | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
GitPullRequestFilter
for pipeline trigger
if (pushFilter?.length && pullRequestFilter?.length) { | ||
throw new Error(`cannot specify both pushFilter and pullRequestFilter for the trigger with sourceAction with name '${sourceAction.actionProperties.actionName}'`); | ||
} | ||
if (!pushFilter?.length && !pullRequestFilter?.length) { | ||
throw new Error(`must specify either pushFilter or pullRequestFilter for the trigger with sourceAction with name '${sourceAction.actionProperties.actionName}'`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no this validation, the error occurred in CFn.
The trigger configuration for the source action is not valid. Make sure to choose one trigger configuration for each source action.
// set to all events if empty array or undefined because CloudFormation does not accept empty array and undefined | ||
const events: string[] = filter.events?.length ? Array.from(new Set(filter.events)) : [ | ||
GitPullRequestEvent.OPEN, | ||
GitPullRequestEvent.UPDATED, | ||
GitPullRequestEvent.CLOSED, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CDK code and CFn with events as an empty array or undefined will occur.
The trigger configuration for the source action is not valid. Make sure to choose one trigger configuration for each source action.
In addition, You must select at least one pull request event.
is displayed in AWS console.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned, going to approve and merge this PR again. We can always have follow-up PR to improve it.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
…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*
…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*
…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*
…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*
Issue # (if applicable)
Closes #29126.
Related PR: #29127
Perhaps if one merges, the other will cause a conflict.
Reason for this change
We would be good to trigger pipelines by git pull request filters.
Description of changes
Add
gitPullRequestFilter
parameter with new interface intoGitConfiguration
interface.Description of how you validated changes
Both unit and integ tests.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license