fix(migrations): skip units the source repository has disabled #253
No reviewers
Labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
codefloe/forgejo-codefloe!253
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/migration-disabled-units"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the failure reported in https://forum.codefloe.com/t/migration-issue/228.
Problem
Migrating a repository from Codeberg (or any Forgejo/Gitea instance) aborts with
The target couldn't be found.when one of the selected items is turned off on the source repository.The source API answers
404for a disabled unit, verified against codeberg.org:/releaseson a repository with releases disabled/issuesand/pullson a repository with issues or pull requests disabled/labelsand/milestoneswhen both issues and pull requests are disabledGiteaDownloaderpassed that 404 up, andmigrate.gotreats any error other than "not supported" as fatal, so the user had to untick each such item by hand.Fix
services/migrations/gitea_downloader_codefloe.go: addunitDisabled, which recognises a 404 on a list request and logs that the unit is skipped. The repository is known to exist becauseGetRepoInfoalready succeeded.services/migrations/gitea_downloader.go: call it fromGetMilestones,GetLabels,GetReleases,GetIssuesandGetPullRequests, returning an empty list instead of an error.services/migrations/gitea_downloader_codefloe_test.go: cover a source answering 404 (empty lists, no error) and 500 (still an error) on every list endpoint.README.md: add a custom changes row.The test fails without the downloader change.
The Forgejo downloader embeds the Gitea one, so both source types get the fix.