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

feat(codepipeline): GitPushFilter with branches and file paths for trigger #29127

Merged
merged 23 commits into from
Jun 3, 2024

Conversation

go-to-k
Copy link
Contributor

@go-to-k go-to-k commented Feb 16, 2024

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.

Description of changes

Add props:

  • branchesExcludes
  • branchesIncludes
  • filePathsExcludes
  • filePathsIncludes

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

@aws-cdk-automation aws-cdk-automation requested a review from a team February 16, 2024 05:16
@github-actions github-actions bot added feature-request A feature should be added or improved. p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Feb 16, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a 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.

@github-actions github-actions bot added the effort/medium Medium work item – several days of effort label Feb 17, 2024
@go-to-k go-to-k force-pushed the pipeline-trigger-branch branch from a0b62b9 to 7007369 Compare February 17, 2024 17:17
fix unit tests

fix unit tests
@go-to-k go-to-k force-pushed the pipeline-trigger-branch branch from 7007369 to 8ebad4e Compare February 17, 2024 17:17
The triggers can only be used with pipeline type V2.

### Push filter
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not separated here by the chapters "Tags" and "Branches" to add pull request filters in the PR.

@go-to-k go-to-k force-pushed the pipeline-trigger-branch branch from 26c0606 to 74820d8 Compare February 22, 2024 16:17
@go-to-k go-to-k changed the title feat(codepipeline): GitPushFilter with branches and file paths for trigger feat(codepipeline): GitPushFilter with branches and file paths for trigger Feb 22, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review February 22, 2024 16:59

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Comment on lines +169 to +171
if (!filter.branchesExcludes && !filter.branchesIncludes && (filter.filePathsExcludes || filter.filePathsIncludes)) {
throw new Error(`cannot specify filePaths without branches in pushFilter for sourceAction with name '${sourceAction.actionProperties.actionName}'`);
}
Copy link
Contributor Author

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 valid filter combinations..

In addition, the file paths in the Branch is optional in the AWS console.

Comment on lines +172 to +174
if ((filter.tagsExcludes || filter.tagsIncludes) && (filter.branchesExcludes || filter.branchesIncludes)) {
throw new Error(`cannot specify both tags and branches in pushFilter for sourceAction with name '${sourceAction.actionProperties.actionName}'`);
}
Copy link
Contributor Author

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 valid filter combinations..

In addition, we can only choose tags or branches (with file paths) in the AWS console.

Comment on lines +175 to +177
if (!filter.tagsExcludes && !filter.tagsIncludes && !filter.branchesExcludes && !filter.branchesIncludes) {
throw new Error(`must specify either tags or branches in pushFilter for sourceAction with name '${sourceAction.actionProperties.actionName}'`);
}
Copy link
Contributor Author

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 valid filter combinations..

@go-to-k go-to-k force-pushed the pipeline-trigger-branch branch from 8f0d1ce to dd62773 Compare February 25, 2024 12:28
add unit test

change unit test order
@github-actions github-actions bot removed the p2 label May 19, 2024
@aws-cdk-automation aws-cdk-automation added pr/needs-maintainer-review This PR needs a review from a Core Team Member and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels May 19, 2024
@amine-mf
Copy link
Contributor

Been here for a while, looks ready, this PR needs some love :) ! Any ETA please?

@go-to-k
Copy link
Contributor Author

go-to-k commented May 27, 2024

@comcalvi

Could you please take a look at this?

I fixed the conflicts caused by the other PR that was merged.

The other PR had been attached the do-not-merge label as well as this PR, but @GavinZZdetached the label and merged the PR (see: #29128 (review)). So could you please detach the label from this PR and merge it?

GavinZZ
GavinZZ previously approved these changes May 27, 2024
Copy link
Contributor

@GavinZZ GavinZZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for this great work and sorry for the wait!

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label May 27, 2024
@go-to-k
Copy link
Contributor Author

go-to-k commented May 28, 2024

@GavinZZ

Thanks for your approval. Could you please detach the 'do-not-merge' label, and merge the PR?

@GavinZZ GavinZZ removed the pr/do-not-merge This PR should not be merged at this time. label May 28, 2024
Copy link
Contributor

mergify bot commented May 28, 2024

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).

@go-to-k
Copy link
Contributor Author

go-to-k commented Jun 2, 2024

@GavinZZ

The merge seems to have failed. Could you please retry?

@mergify mergify bot dismissed GavinZZ’s stale review June 3, 2024 20:31

Pull request has been modified.

Copy link
Contributor

mergify bot commented Jun 3, 2024

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-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: e22a8f2
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit ddbbd00 into aws:main Jun 3, 2024
9 checks passed
Copy link
Contributor

mergify bot commented Jun 3, 2024

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).

@go-to-k go-to-k deleted the pipeline-trigger-branch branch June 4, 2024 01:44
mergify bot pushed a commit that referenced this pull request Jun 6, 2024
@eriktisme
Copy link
Contributor

Why was it reverted?

@moltar
Copy link
Contributor

moltar commented Jun 7, 2024

I was really looking forward to this PR being released in the next version. 😭

@go-to-k
Copy link
Contributor Author

go-to-k commented Jun 7, 2024

That is really unfortunate. I'm in the process of asking the maintainer.

#30462 (comment)

vdahlberg pushed a commit to vdahlberg/aws-cdk that referenced this pull request 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 pull request 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*
Leo10Gama pushed a commit to Leo10Gama/aws-cdk that referenced this pull request Jun 11, 2024
mazyu36 pushed a commit to mazyu36/aws-cdk that referenced this pull request 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*
mazyu36 pushed a commit to mazyu36/aws-cdk that referenced this pull request Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distinguished-contributor [Pilot] contributed 50+ PRs to the CDK 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 this pull request may close these issues.

codepipeline: Add Branches and File Paths to CodePipeline pipeline GitPushFilter configuration
9 participants