-
Notifications
You must be signed in to change notification settings - Fork 738
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(eventsources/bitbucketserver): add OneEventPerChange config option for webhook event handling #3135
feat(eventsources/bitbucketserver): add OneEventPerChange config option for webhook event handling #3135
Conversation
c5db188
to
6cd8e4f
Compare
@@ -1051,7 +1051,7 @@ type BitbucketAuth struct { | |||
OAuthToken *corev1.SecretKeySelector `json:"oauthToken,omitempty" protobuf:"bytes,2,opt,name=oauthToken"` | |||
} | |||
|
|||
// BasicAuth holds the information required to authenticate user via basic auth mechanism | |||
// BitbucketBasicAuth holds the information required to authenticate user via basic auth mechanism |
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!
// It returns a slice of byte slices containing the processed or original webhook events, and any error encountered during processing. | ||
func webhookHandler(request *http.Request, logger *zap.SugaredLogger, body []byte, bitbucketserverEventSource *v1alpha1.BitbucketServerEventSource, router *Router) ([][]byte, error) { | ||
if request.Header.Get("X-Event-Key") != "repo:refs_changed" { | ||
// Don't continue if this is not a repo:refs_changed webhook event. |
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.
Is this the same as the previous logic?
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.
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.
@whynowy does that explanation help?
340ab36
to
be77d2c
Compare
665ae50
to
14674ae
Compare
Ive been using this change with and without webhooks in production and it is working fine. |
Hey @whynowy just a note we have been running this change in production for a while now with no issues. Any chance you can review it? This change is what makes Argo project a viable alternative to Jenkins for Bitbucket. |
f806d73
to
31a4f20
Compare
eventsources/sources/bitbucketserver/custombitbucketserverclient.go
Outdated
Show resolved
Hide resolved
@whynowy ??? |
…on for webhook event handling Add OneEventPerChange config option to control whether to process each change in a repo:refs_changed webhook event as a separate event. This allows independent processing of each tag or reference update in a single webhook event useful for triggering distinct workflows in Argo Workflows. Signed-off-by: Ryan Currah <[email protected]>
a37abde
to
58f941f
Compare
Signed-off-by: Ryan Currah <[email protected]>
2f0f9d9
to
cd9c028
Compare
Signed-off-by: Ryan Currah <[email protected]>
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! I assume it has been well tested.
Yeah we have been using this branch for a while now. It will also resolve an issue @tooptoop4 reported. |
when is next release? 🤞 |
Add OneEventPerChange config option to control whether to process each change in a repo:refs_changed webhook event as a separate event. This allows independent processing of each tag or reference update in a single webhook event, useful for triggering distinct workflows in Argo Workflows.
Example Webhook Event with Multiple Changes
The above ☝️ webhook event would be turned into two
BitbucketServerEventData
events,.changes[]
will not have a length greater than one.Split Up Webhook Event 1 (Shortened for brevity)
Split Up Webhook Event 2 (Shortened for brevity)
Checklist: