Update bitbucket cloud importer to fetch workspace scoped repositories
What does this MR do and why?
This MR updates Bitbucket Cloud Importer client and adds an ability to fetch repositories across multiple workspaces user has access to. Instead of /repositories that returns repos across all workspaces we now use /repositories/<workspace> to fetch from each workspace and combine the results, to be presented on the importer status page (where user can select which repo to migrate).
Reason for replacement: bitbucket announced deprecation of this endpoint and it's going to be no longer available after
Since we fetch from individual workspaces and need to combine results into one, we have to track each workspace pagination state separately. For this reason, the statu.json endpoint workspace_page_infos that looks like this:
Behind bitbucket_cloud_importer_multi_workspace_repos feature flag.
References
Screenshots or screen recordings
Demo with page length 3 and workspace page length 1, to force fetch multiple pages of workspaces and workspace repos.
| Before | After |
|---|---|
How to set up and validate locally
- Enable
bitbucket_cloud_importer_multi_workspace_reposfeature flag - Setup bitbucket oauth locally https://docs.gitlab.com/user/import/bitbucket_cloud/#prerequisites
- Create a bunch of projects on bitbucket across multiple workspaces (get invited by others or use integrations account in 1p)
- Go to
/import/bitbucket/statuspage and. observe repos getting fetched from multiple workspaces - Disable
bitbucket_cloud_importer_multi_workspace_reposfeature flag - Check the old behavior still works as expected
- Try other importers (e.g. github) status page, should still work as expected and these changes should not affect other importers.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
