Repository navigation
Import through the format's own protocol (NuGet feed, registry catalog), named neutrally - #712
Merged
Merged
Conversation
An import found what to copy through Nexus 3's REST API, so it could only import from a Nexus. It now reads its source through the format's own protocol, through the format plugin's upstream conversations, so a hosted repository imports from any server that speaks it: - NuGet: a v3 feed's service index. Its search (walked to an empty page: Nexus reports a page's hits as the total) names the package ids, the package base address lists every version, unlisted ones included, and serves the .nupkg, the registration gives the publish time and, where inline, the SHA-512 the download is verified against and a re-run compares without downloading. A new UpstreamOp::Packages walks the search past nuget.org's offset cap. - Docker: a registry's catalog (a new UpstreamOp::ImageCatalog), its tag lists, and the referrers API for each copied manifest; a registry without it keeps referrers under tags (cosign's .sig, the referrers tag schema), copied like any other. - An import can name its package ids or images instead, for a source without a search or catalog. - An imported version counts as downloaded at its import, so retention's not_downloaded_for_days does not delete it right after; nuget.org's 1900-01-01 is no publish time; a tag is created at its import. The module, tables (migration 0007), API view, web UI and docs drop the Nexus name. The previous request (a Nexus url and repository) is still accepted, and an import stored before the upgrade lists and resumes, its password still opening. Fixes #642 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012e6DJXRhLYxFjzrWiwKFKc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #642
An import found what to copy through Nexus 3's REST API, so it could only import from a Nexus. It now reads the source through the format's own protocol, using the format plugins' upstream conversations, the same ones proxy repositories hold. A hosted repository can therefore import from Nexus, Artifactory, ProGet, BaGet, Harbor, a
distributionregistry or another Forge.NuGet: a v3 feed
UpstreamOp::Packages { skip, take }walks it. The proxy'sSearchstays capped at nuget.org's offset of 3,000; the walk is not.totalHits. Against a real Nexus 3.70,totalHitsis the number of hits in the returned page (take=1→ 1;take=100→ all 5). If the search ignoresskipand returns the same page again, the import stops with an error.source_total: the preflight reads the first page of 100. The scan then raises the total to as many packages as it walked.PackageBaseAddress, which lists unlisted versions too. The.nupkgis downloaded from the same resource.publishedfrom the registration. A year ≤ 1900 (nuget.org's1900-01-01) is no publish time.packageHash(SHA-512) where one is listed. Forge and nuget.org list one; Nexus does not. A re-run skips a version Forge holds with that hash without downloading it; without a hash, the version is downloaded and compared. New:VersionMetadata.sha512andHostedWrite::package_sha512.Docker: a registry's catalog
/v2/_catalog, read through a newUpstreamOp::ImageCatalog. The docker format now shares one paged listing for tags and the catalog.manifestitems. A registry without the API keeps referrers under tags (cosign'ssha256-<d>.sig, the referrers tag schema'ssha256-<d>); those are copied like any other tag. This replaces the scan of Nexus' asset listing.Named imports
nameslists the package IDs or images to copy, for a feed without a search, packages Nexus' search misses, or a registry without a catalog. A named ID the source lacks becomes a failed item that says so.What the protocols do not carry
not_downloaded_for_daysdoes not delete it right after.Neutral names
crate::nexus_importis nowcrate::import, and the Nexus REST client is gone.0007renamesnexus_import/nexus_import_item(with their constraints, indexes and sequences) torepository_import/repository_import_item.base_url→url,nexus_version→source_server. New columnsnamesandsource_total.assets_seenandbytes_seenare dropped.scan_listingtakessearch,catalogornames.nexus_import, so a password sealed before the upgrade still opens.urlandsource_repository. The worker reads<url>/repository/<name>/index.json, or the registry, through the protocol. If it was scanning, its scan starts over.url+repository[+registry_url]) is still accepted and stored as the derived source URL.Docs
docs/import.mdis the guide.docs/nexus-import.mdstays as a short Nexus page, linked from it: URLs, the 10,000-package search cap and its page-sizedtotalHits, privileges, and imports stored before 2.2. The released 2.0 changelog links that path, and a change never editsCHANGELOG.md.642.feature.mdand642.upgrade.md.Tests
crates/server/tests/import.rs: rewritten against a mock source. It serves a NuGet v3 feed and a registry under Nexus' paths, with Basic auth, and can switch off the search, the catalog or the referrers API, or report page-sized totals like Nexus. 12 tests:deleted: 1).crates/db/tests/migrations.rs: migrates to 0006, stores imports in the oldnexus_importshape with an item and a password sealed as before, then migrates on. Rows, items, listing, cursor and the password come through; one active import per repository is still enforced; nothing keeps anexusname.crates/e2e/tests/import.rs), run locally:/repository/nuget-hosted/index.json, with publish dates equal to the registration's. Docker through the connector's catalog with 105 images, a cosign signature, and anoras attach-style referrer through the tag schema. A second run in the legacy request form.registry:2: catalog, signature and tag-schema referrer; a second run is allidentical.cargo clippy --workspace --all-targets --all-features -D warnings(offline);--lib,registry,plugin_contract,proxy_search,group_proxy;cargo xtask changelog --checkandcargo xtask docs --check;tsc, all 524 vitest tests, andbuild.Notes
0007leaves room for Auth realms: accept client passwords over HTTP Basic per realm #708's0006. They touch different tables and apply in either order.Generated by Claude Code