-
Notifications
You must be signed in to change notification settings - Fork 723
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
base: master
Are you sure you want to change the base?
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
be77d2c
to
eedf4d3
Compare
…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 <ryan@currah.ca>
eedf4d3
to
ccb7c1b
Compare
…ts or repos and added unit tests. Signed-off-by: Ryan Currah <ryan@currah.ca>
665ae50
to
14674ae
Compare
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: