Repository navigation
Closed
Labels
enhancementNew feature or request
Milestone
Description
Summary
Forge replaces Nexus (#37). Credential forwarding already moves the logins, and a proxy simply refills from its upstream. But the content of Nexus' hosted repositories has to be pushed again by hand: internal NuGet packages, images, Helm charts, raw files. This issue adds an importer, one repository at a time: point a Forge hosted repository at a Nexus hosted repository of the same format, and Forge copies its content.
Where things stand
- There is no import.
- The workaround is a script per format (
dotnet nuget pushper package,crane/skopeoper image,curlper chart). It loses:- the original publish dates. Retention's
older_than_daysthen treats every imported version as brand new; - the last-download times.
not_downloaded_for_daysandkeep_n_most_downloadedthen start from zero; - who uploaded what.
- the original publish dates. Retention's
Proposal
Starting an import
- In the web UI (Repository → Import) and the admin API (
POST /admin/repositories/{name}/imports), on a hosted Forge repository. - Source:
- the Nexus base URL;
- the Nexus repository name;
- credentials, sealed with the secret encryption and deleted when the import finishes.
- Preflight / dry run
- Checks the Nexus version (
/service/rest/v1/status) and that the source repository is hosted and of the same format (/service/rest/v1/repositories). - Counts components, assets and total size.
- Lists the conflicts with versions Forge already has.
- Checks the Nexus version (
Copying
- Walk
GET /service/rest/v1/components?repository=<name>, page by page withcontinuationToken. The token is stored as the import's cursor, so an import resumes after a restart, a failure or a cancel. - Each asset is streamed from its
downloadUrlinto staging and verified against Nexus' checksums. - It is written through the normal hosted write path: format validation, package selectors, upload limit, CAS dedup and audit. The audit events carry the action
import(Audit log in the database: searchable in the web UI and admin API, with retention and export #179). - Metadata is preserved where Nexus exposes it (recent Nexus 3 versions):
blobCreated/lastModifiedbecome the version's creation time;lastDownloadedbecomes its last download;uploaderis recorded in the audit details.
- Conflicts
- The same id/version with the same SHA-256 is skipped.
- A different file under the same id/version is skipped and reported (the default), overwritten, or fails the import, as chosen.
- Throughput: configurable concurrency (default 4), so Nexus is not overwhelmed.
- Progress in the UI and API: components done/total, bytes, failures. Failed items can be retried on their own, and an import can be cancelled.
- Re-running is an incremental sync that copies only what is new. Cutover is then an initial import, then a final delta just before DNS or client config switches to Forge.
- One instance runs a given import at a time, with a lease in Postgres like the retention worker.
Per format
- NuGet: the
.nupkgper version. - Docker: Nexus lists images as components (name, version = tag). Forge copies through the registry API of the Nexus repository (its connector port or path-based route), like
crane copy:- digests are preserved;
- multi-platform indexes and referrers (signatures, SBOMs) are copied when present.
- Helm (Helm charts: classic chart repositories and OCI charts #43): the chart
.tgz. - As each format lands:
- raw (Raw (generic file) repositories: hosted, proxy and group, Nexus-style #42): every file with its path;
- npm (npm registry: hosted, proxy and group repositories with npm login #41): tarball and dist-tags;
- Maven (Maven repositories: hosted (releases and snapshots), proxy and group, Nexus-style #177): every file of each GAV, including checksums and signatures;
- apt (apt (Debian/Ubuntu) repositories: hosted, proxy and group, Nexus-style #176): the
.debfiles, re-indexed and re-signed with the Forge repository's key.
Out of scope
- Proxy repositories: they refill from the upstream.
- Groups: recreate them as configuration.
- Nexus users, roles and privileges: credential forwarding covers sign-in.
- Cleanup policies.
Open questions
- Should the import also create the Forge repository from the Nexus repository's settings (name, format, redeploy policy, anonymous access)?
- Artifactory as a second source later, with the same job model?
Acceptance criteria
- e2e against a real Nexus 3 OSS container (
sonatype/nexus3) seeded with NuGet packages, a multi-platform image with a cosign signature, and a Helm chart:- after the import, bytes and digests are identical and publish dates are preserved;
- killing Forge mid-import and restarting resumes the import without duplicating anything;
- a second run imports only items added to Nexus since.
- Dry run reports counts, size and conflicts without writing anything.
- Every conflict policy is covered by tests.
- Imported versions are audited as imports.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
Import a Nexus hosted repository into a Forge hosted repository