jenkinsci/bitbucket-branch-source-plugin

Skip scans in organisation folders that don't own the repository

wkjwjrantrzk opened this issue · 2 comments

What feature do you want to see added?

Processing webhooks triggers scans on every organisation folder even on those that do not have the repository.
This causes a huge overload our Jenkins, as we have over than dozen of those folders. And if I understand correctly each scan sends requests to Bitbucket and in result we reach Bitbucket's API request limit because of this huge number of API calls with each webhook execution.

Add feature to trigger scan only on repositories that really needs it.

Upstream changes

No response

We are seeing the same thing, we are using a Bitbucket Team/Project build per bitbucket project, and it each one of them is scanning ALL repositories in our account and its causing constant rate limits

What it appears is happening is its grabbing ALL repositories and checking each repository one at a time which is rate limiting.

To prevent rate limiting, it should be filtering BEFORE getting the repository list

https://api.bitbucket.org/2.0/repositories/{owner}?q=project.key="ABC"

It looks like this just needs to allow the project key or any custom filters to be included to the repositories api call instead of calling the api again per repository to check if its in the project

final UriTemplate template = UriTemplate.fromTemplate(V2_API_BASE_URL + "{/owner}{?role,page,pagelen}")

This has now been released :)