-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
CodeBuild Webhook FilterGroups #8110
CodeBuild Webhook FilterGroups #8110
Conversation
Shall i add a notice that the branch_filter argument is deprecated? |
IMHO, no. This option still available on Go SDK. |
I added a note about using filter_group over branch_filter like in the AWS docs: https://docs.aws.amazon.com/de_de/codebuild/latest/APIReference/API_Webhook.html It's working so far. Only thing left are the tests. First I have to read the docs and then I will implement them 😅 |
I added the test as far as i came. It throws this exception: |
Hi @tomkuehl 👋 The BitBucket and GitHub repositories the CodeBuild resources use for testing can be controlled via the |
Thank you @bflad !! Now the test works. I only have one question left: Why? :D I thought these numbers (e.g. 3033132000: https://github.com/terraform-providers/terraform-provider-aws/pull/8110/files#diff-8984e55d6f33639a7b185d987d2233eeR174) where auto-generated? And what exactly is this step for? https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_codebuild_webhook_test.go#L149-L154 Do we need it in the filter_group test as well? Because it doesn't work.. ^^ |
Those // After testAccCheckAWSCodeBuildWebhookExists() call in Check
testAccCheckAWSCodeBuildWebhookFilters(&webhook, [][]*codebuild.WebhookFilter{
// fill in details
}),
// new top level function
func testAccCheckAWSCodeBuildWebhookFilters(webhook *codebuild.Webhook, expectedFilters [][]*codebuild.WebhookFilter) resource.TestCheckFunc {
return func(s *terraform.State) error {
if webhook == nil {
return fmt.Errorf("webhook missing")
}
if !reflect.DeepEqual(webhook.FilterGroups, expectedFilters) {
return fmt.Errorf("expected webhook filter configuration (%v), got: %v", expectedFilters, webhook.FilterGroups)
}
return nil
}
}
Yes, that should be included. It verifies that someone can run |
Thanks! This is the error from the test:
And the error from |
Hello, @tomkuehl! Thank you for this PR. I can see that there is a functionality to create multiple event filter groups for a webhook. Do you have plans to implement that as well? |
Hey @danisabad, thanks for testing it! What exactly do you mean? You can already provide multiple event types as a comma-separated string. e.g.:
|
@tomkuehl This looks awesome! How far from completion you think this PR is? I would love to have this feature available cause now I have to stick with cloudformation templates which are quite cumbersome to reuse in this case. |
Hi @sgal! Currently the test is failing & last time i worked on it, i didn't find out why... I also want to implement the use case @danisabad showed. (Didn't know it was possible in the first place). When these 2 things are done it should be ready to merge. Currently i don't have much time to work on this, so any help is welcome :) |
Hi @tomkuehl, Thank you for this PR!
Hope this help 👍 resource_aws_codebuild_webhook.zip Edit
|
Awesome @raivenlilianto, thank you!!! So if i'm right, the last thing missing is the functionality to add multiple event filter groups? I start working on this now |
If you try and set both branchFilter and filterGroups at the same time, AWS gives a warning along the lines of Since filterGroups are a strict superset of the branchFilter functionality, I would suggest deprecating the |
Multiple filter_groups are working now... But i broke the tests |
@tomkuehl According to CI it is all green now - is there anything that's missing? |
The CI was red because the test was incompatible with multiple filter groups. This one is fixed now, but if i run
I didn't find out why it happens yet.. |
Here we go, fixed the tests! IMO this PR is now ready to merge :) |
Can we get this reviewed? :) cc @bflad |
Guys, please merge it. I really surprised that I cant manage it from terraform. |
Thanks for the efforts @tomkuehl I hope this is merged soon, we need it for one of the projects. |
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.
Thanks so much, @tomkuehl, LGTM! 🚀
Output from acceptance testing (failure unrelated):
--- FAIL: TestAccAWSCodeBuildWebhook_Bitbucket (18.23s)
--- PASS: TestAccAWSCodeBuildWebhook_BranchFilter (27.73s)
--- PASS: TestAccAWSCodeBuildWebhook_GitHub (29.55s)
--- PASS: TestAccAWSCodeBuildWebhook_FilterGroup (29.98s)
--- PASS: TestAccAWSCodeBuildWebhook_GitHubEnterprise (35.98s)
This has been released in version 2.14.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Fixes #7503
Changes proposed in this pull request:
Output from acceptance testing:
ToDo: