feat(migrations): add repository migration from bitbucket.org (#38607)

Adds migration from bitbucket.org as the Cloud variant of the Bitbucket
entry, in the web UI and via `POST /repos/migrate` with
`service=bitbucket`. It migrates the repository and pull requests with
their comments and reviews. Bitbucket Cloud has no releases, and
Atlassian removed its issues and wikis on 2026-08-20
(https://community.atlassian.com/forums/Bitbucket-articles/Announcing-sunset-of-Bitbucket-Issues-and-Wikis/ba-p/3193882).

- Private repositories need an API or access token, which also raises
the rate limit.
- Rate-limited requests back off and retry, Bitbucket sends no
`Retry-After`.
- Tests replay recorded responses, set `BITBUCKET_READ_TOKEN` to
re-record.

Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
Lunny Xiaoandsilverwind authored and GitHub committed 2026-10-31 14:51:43 +00:00
1 parent cc20c4c11b
commit bd5fbcfb29
21 files changed
+874 -80

No files matched your search

+7 -12
View File
@@ -359,6 +359,7 @@ const (
CodeCommitService // 9 codecommit service
BitbucketServerService // 10 bitbucket server (data center) service
ForgejoService // 11 forgejo service
BitbucketService // 12 bitbucket.org service
)
// Name represents the service type's name
@@ -390,6 +391,8 @@ func (gt GitServiceType) Title() string {
return "Bitbucket Server"
case ForgejoService:
return "Forgejo"
case BitbucketService:
return "Bitbucket"
case PlainGitService:
return "Git"
}
@@ -399,21 +402,12 @@ func (gt GitServiceType) Title() string {
// Variants returns the hosting options of gt's provider, which share one entry on the migrate page
func (gt GitServiceType) Variants() []GitServiceType {
switch gt {
case BitbucketServerService:
return []GitServiceType{BitbucketServerService}
case BitbucketService, BitbucketServerService:
return []GitServiceType{BitbucketService, BitbucketServerService}
}
return nil
}
// ProviderTitle returns the title of gt's entry on the migrate page
func (gt GitServiceType) ProviderTitle() string {
switch gt {
case BitbucketServerService:
return "Bitbucket"
}
return gt.Title()
}
// MigrateRepoOptions options for migrating repository's
// this is used to interact with api v1
type MigrateRepoOptions struct {
@@ -426,7 +420,7 @@ type MigrateRepoOptions struct {
// required: true
RepoName string `json:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
// enum: ["git","github","gitea","gitlab","gogs","onedev","gitbucket","codebase","codecommit","bitbucketserver","forgejo"]
// enum: ["git","github","gitea","gitlab","gogs","onedev","gitbucket","codebase","codecommit","bitbucketserver","forgejo","bitbucket"]
Service string `json:"service"`
AuthUsername string `json:"auth_username"`
AuthPassword string `json:"auth_password"`
@@ -464,6 +458,7 @@ var SupportedFullGitService = []GitServiceType{
GithubService,
GitlabService,
GiteaService,
BitbucketService,
ForgejoService,
GogsService,
OneDevService,