-
Notifications
You must be signed in to change notification settings - Fork 30
enhance(scm/repo): mirror allowed events with sent events #679
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #679 +/- ##
==========================================
+ Coverage 56.89% 56.99% +0.10%
==========================================
Files 243 243
Lines 15939 15997 +58
==========================================
+ Hits 9069 9118 +49
- Misses 6468 6474 +6
- Partials 402 405 +3
|
|
Nice! From the issue description, we really need this. I don't understand what the issue with push vs tag is. If you have time, could you post a few links to where the code needs to be disambiguated? I can also go looking next time I have some time to look. |
For sure! The way GitHub is set up, they send tag events as a sub-action of a push (Docs). We distinguish this in the code in scm/webhook.go. So if a user chose to unsubscribe to |
cognifloyd
left a comment
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 for the links. That makes more sense.
Maybe update the PR description for future reviewers since that question has been resolved. 😄
jbrockopp
left a comment
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.
LGTM
wass3r
left a comment
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.
in my testing against github.com this does not seem to work. when enabling a repo i get
Status 500 (unable to create initialization webhook for wass3r/vela-test: empty webhook repo_id provided)
we will need to set repo id or otherwise solve for this. the error comes from: https://github.com/go-vela/types/blob/ef95941428d9195503c3db067a9f27447b4dcc16/database/hook.go#L162
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.
little bit of whack-a-mole.. now getting this error:
Status 500 (unable to create initialization webhook for wass3r/vela-test: empty webhook source_id provided)
😭
|
Sorry about that! All required hook fields have been set now. I also included some extra testing in the scm |
wass3r
left a comment
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 for the fixes. tested on github.com and works great. nice work.
too bad we can't force update existing hooks in github.
jbrockopp
left a comment
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.
LGTM
Closes go-vela/community#539
Now that we store the
webhook_idin the hooks table, we're able to edit the webhook whenever a user updates their repo settings. With this functionality, we will consume far less webhook payloads from the SCM and users won't have to deal with error messages for events they do not want enabled.A thing to note: I added an
initializewebhook whenever a repo is enabled. This ensures that when a user adjusts settings right after enabling their repo, we have record of the webhook_id to edit.Would love to hear thoughts!