Add organization migration feature#36782
Conversation
Add ability to migrate all repositories from an organization on GitHub, GitLab, Gitea, Gogs, and other supported platforms in a single operation. New features: - Add GetOrgRepositories to the Downloader interface and implement it for GitHub, GitLab, Gitea, Gogs, OneDev, Codebase, CodeCommit, and GitBucket - Add MigrateOrganization service function that iterates org repos and calls MigrateRepository for each - Add web UI at /org/migrate with service picker, credentials, org name, and content selection options - Add REST API endpoint POST /api/v1/orgs/migrate with MigrateOrgOptions input and OrgMigrationResult response - Add integration tests covering auth, authorization, validation, and error cases - Add swagger type registrations for MigrateOrgOptions and OrgMigrationResult - Add locale strings for all new UI labels
00992e3 to
c1b99bf
Compare
|
Any UI examples? |
- Update MigrateOrgOptions struct to use ptr(true) instead of new(bool) for IncludeSubGroups
- Fix codebase.go: fmt.Sprintf -> string concatenation
- Fix migrate.go: errors.New instead of fmt.Errorf
- Run make fmt
- Run make generate-swagger
- Commit and push
|
Authorship: Codex (GPT-5.3) Overall this is a strong feature addition, but I see a few blocking correctness issues before merge.
|
- Add policy checks to API handler: - Check mirror.DisableNewPull before allowing mirrors - Enforce Repository.ForcePrivate setting - Enforce LFS.StartServer setting - Fix clone URL reconstruction to use repo.CloneURL from provider instead of string concatenation (fixes panic for GitHub/GitLab)
The perfsprint linter requires errors.New() when there are no format arguments in fmt.Errorf().
- Add placeholder repo name to CloneAddr when creating downloader for org migration. The GitHub factory expects /owner/repo format but GetOrgRepositories only uses the orgName parameter. The placeholder prevents index out of bounds panic when factory parses the URL path. - Fix test token scopes to include both WriteOrganization and WriteRepository
|
The tests contain references to |
|
In UI there is stuff odd
|
|
Also the cut-off "g" in source org name is a issue that I think we have solved already, but I could be wrong. Check other similar dropdowns if they are structurally identical. |
19cbb39 to
ac72f68
Compare
fixed it
added different text instead of reusing old one
fixed it. |
|
This comment was written by Codex on behalf of @bircni Findings for PR #36782 (#36782):
|
- Add auth_username/auth_password fields to web UI for non-token auth services (Git, Gogs, OneDev, GitBucket, Codebase) - Filter out CodeCommit from org migration dropdown since GetOrgRepositories is not supported for that service - Mark source_org_name and target_org_name as required in OpenAPI schema
da9aa0f to
f612a23
Compare


Summary
This PR adds the ability to migrate all repositories from an organization on a supported external platform (GitHub, GitLab, Gitea, Gogs, OneDev, Codebase, CodeCommit, GitBucket) into a target Gitea organization in a single operation.
What this PR does
GetOrgRepositories(ctx, orgName, page, perPage)to theDownloaderinterface and implements it for all supported migration backends (GitHub, GitLab, Gitea, Gogs, OneDev, Codebase, CodeCommit, GitBucket)MigrateOrganizationservice function that pages through the source org's repos and callsMigrateRepositoryfor each one, collecting per-repo success/failure results/org/migratewith fields for source URL, service type, credentials, source/target org names, and content options (wiki, issues, labels, milestones, releases, PRs)POST /api/v1/orgs/migrate(requires org-owner or admin) withMigrateOrgOptionsinput andOrgMigrationResultresponseMigrateOrgOptions(input) andOrgMigrationResult(response)Usage
Web UI: Navigate to Organization Settings → Migrate (or
/org/migrate). Fill in the source platform URL, select the service type, provide credentials, enter source and target org names, select which content to include, and submit. A success page lists migrated and failed repositories.API:
Response:
{ "total_repos": 12, "migrated_repos": ["repo-a", "repo-b", ...], "failed_repos": [{"repo_name": "repo-c", "error": "..."}] }Testing
make test-sqlite#TestOrgMigratePOST /api/v1/orgs/migratewith credentials for a test org on another platformNotes
failed_reposlist so callers can retry specific repos"mirror": truein the request