aws_codebuild: REPOSITORY_NAME/WORKFLOW_NAME webhook filters and webhook scope configuration
Describe the feature
CodeBuild webhooks in CDK should support the REPOSITORY_NAME/WORKFLOW name filters e.g.
const source = codebuild.Source.gitHub({
owner: 'owner',
repo: 'repo',
webhook: true,
webhookFilters: [FilterGroup.inEventOf(EventAction.WORKFLOW_JOB_QUEUED).andRepositoryNameIs("repo_name")],
})
as these filter types are currently missing (https://docs.aws.amazon.com/codebuild/latest/APIReference/API_WebhookFilter.html). Additionally, there is no option to provide a scope configuration for the webhook in the source (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-scopeconfiguration.html).
Use Case
The REPOSITORY_NAME/WORKFLOW_NAME filters are used to filter out organization/global webhook events, so that the webhook doesn't trigger builds for specific repositories/workflows. Additionally, scope configuration is needed to create an organization or global webhook (https://docs.aws.amazon.com/codebuild/latest/userguide/github-global-organization-webhook.html)
Proposed Solution
Add repository name and workflow name to the list of webhook filters and allow a scope configuration to be provided in the source for the webhook
Other Information
No response
Acknowledgements
- [X] I may be able to implement this feature request
- [X] This feature might incur a breaking change
CDK version used
2.162.1
Environment details (OS name and version, etc.)
Any
Hi @colyoonamaz , thanks for reaching out.
Is this FR in accordance with this bug reported - https://github.com/aws/aws-cdk/issues/31726
Could you please check and share your insights ?
I've submitted a PR that adds support for creating GitHub organization-level webhooks directly in the GitHubSource construct for CodeBuild.
However, I'm currently running into issues with building the aws-cdk-lib package locally and could use some help testing this feature. If anyone can assist by setting up a CodeBuild project with the new organization webhook property and verifying that it works as expected, I would greatly appreciate it!
Thanks in advance for any help and feedback!
Thanks @dviryamin for submtting a PR. For guidance/help, you could-
- Reach out to CDK.DEV community and ask for help.
- Youtube tutorials.
- Community posts.
Hope this would be helpful!
@khushail, https://github.com/aws/aws-cdk/issues/31726 looks like a separate issue, as this is in relation to missing attributes rather than webhook creation failures
Hi @colyoonamaz, Thank you so much for your guidance and help! I was able to successfully build the aws-cdk-lib package locally and test my pull request with the new organization webhook feature. Everything worked as expected on my end.
It would be great if you could test it out as well and let me know if it resolves the issue you were facing. I’d really appreciate your feedback!
I've submitted a PR that adds support for creating GitHub organization-level webhooks directly in the GitHubSource construct for CodeBuild.
However, I'm currently running into issues with building the aws-cdk-lib package locally and could use some help testing this feature. If anyone can assist by setting up a CodeBuild project with the new organization webhook property and verifying that it works as expected, I would greatly appreciate it!
Thanks in advance for any help and feedback!
@dviryamin could you post a snippet on how to currently get this done configuring the underlying codebuild CfnProject, until your PR is reviewed and merged?
@shivatalwar I just posted a Gist Post with detailed tutorial
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.
Thanks, marked the issue as completed