argoproj / argo-events

Event-driven Automation Framework for Kubernetes
https://argoproj.github.io/argo-events/
Apache License 2.0
2.28k stars 722 forks source link

bitbucket server eventsource regressions #3175

Open tooptoop4 opened 1 week ago

tooptoop4 commented 1 week ago

in v1.8.1 everything worked fine but in v1.9.2 it fails for few reasons

  1. accesstoken is mandatory now https://github.com/argoproj/argo-events/blob/v1.9.2/eventsources/sources/bitbucketserver/start.go#L225

  2. list webhooks fails now (not all users have access for that) https://github.com/argoproj/argo-events/blob/v1.9.2/eventsources/sources/bitbucketserver/start.go#L336

what i'm confused with is why this is now trying to list/create webhook directly on bitbucket when before the eventsource would purely setup an independent endpoint that could be curled. and u could manually create the bitbucket webhook in bitbucket ui itself to point to the endpoint.

cc @ryancurrah

ryancurrah commented 1 week ago

Hrm that's probably a regression. I will take look next week when I'm back from vacation.

ryancurrah commented 1 week ago

Fixed in my latest change to https://github.com/argoproj/argo-events/pull/3135. We are turning off webhook management as we are using Bitbucket v8 now and it has the ability to manage repository webhooks at the project level, negating the need for this feature. When we turned it off we ran into the same problem. I am validating the fix over the next day.

tooptoop4 commented 6 days ago

i still see stuff like "applyBitbucketServerWebhooks ensures all configured repositories have the correct webhook settings applied." can you make it have an option to not make any api calls to bitbucket? i want argo-events to listen to a port, then i manually configure bitbucket with my personal user (outside of argo) to point requests to the port

ryancurrah commented 6 days ago

It skips creating webhooks if the following conditions are not met.

func (b BitbucketServerEventSource) ShouldCreateWebhooks() bool {
    return b.AccessToken != nil &&
        b.Webhook != nil &&
        b.Webhook.URL != "" &&
        ((len(b.GetBitbucketServerRepositories()) > 0 && b.GetBitbucketServerRepositories() != nil) || len(b.Projects) > 0)
}

Additionally checkout the below code. Where when setting up the event source it determines if bitbucket clients should be setup and webhooks.

https://github.com/argoproj/argo-events/pull/3135/files?diff=unified&w=0#diff-db89328aef0ace4823c4f3574140ac35a0d1dc7c7e4d24db4d926fb862489f4fR78-R94