Repository navigation
Description
Problem
The only way to put an artifact that is already stored into another repository is a release bundle: create it, add the item, seal it, promote it. That is the right tool for a release, and too heavy for two everyday jobs:
- Promoting one artifact, such as a jar from
libs-devtolibs-staging, or a wheel a team has approved forpypi-prod. Without a bundle, the file has to be downloaded and uploaded again. The new upload loses its properties and scan results, and moves every byte through the client twice. - Fixing a publish to the wrong repository. Delete and upload again, from a copy of the file the user still has to find.
Other artifact managers have these as basic operations: Artifactory's copy and move API and UI actions, and Nexus Pro's staging move.
Proposal
Copy and move as a repository operation, for the API, oa and the web UI, built on the promotion engine.
internal/promote already does exactly the copy step. It finds the live source files of a content digest, writes the same rows (new ids) into the destination in one transaction, and never touches the bytes, because blobs are content-addressed. It also reports the same content already present as Existing (idempotent) and different content as a 409 conflict, refuses quarantined sources, applies the target's license policy and immutable releases, charges the target's quota, and queues the metadata regeneration. This proposal exposes that per artifact, without a bundle.
API
POST /api/v1/repositories/{source}/copy
POST /api/v1/repositories/{source}/move
{
"target": "libs-prod",
"items": [
{"package": "com.acme:core", "version": "1.4.0"},
{"sha256": "<hex>", "path": "com/acme/core/1.4.0/core-1.4.0.jar"}
],
"dry_run": false,
"force": false
}
- Selection. An item is either a package version (every live file of that version, the unit people think in) or a content digest with an optional path (the bundle-item form, read with
itempathso it resolves the same way). For docker,sha256is the manifest digest, with an optionaltag, handled by the existing docker promoter. - All or nothing. Every item is copied in one transaction, as a bundle promotion is. The response is the promotion report per item (
copied,existing,replaced). dry_runreturns the same report without writing.forcereplaces conflicting content in the target and moves the replaced files to the target's trash. It is limited to admins, as?force=trueis for promotion.- Move is a copy followed, in the same transaction, by moving the source files to the source's trash. A wrong move can then be undone with the existing restore, and retention still applies. A source file that is held by a sealed bundle or protected by immutable releases is not moved (
409).
Authorization
Like bundle promotion: the RBAC gate only requires a real principal for these routes, and the handler checks each repository (for bundles, "read on the sources, write on the target"):
- copy:
readon the source at each item's path, andwriteon the target; - move: copy's rules, plus
deleteon the source.
These routes are not manage, so a CI token scoped to two repositories can promote between them without being an admin. Project roles apply through each repository's project.
Side effects
- Webhooks:
artifact.uploadedfor each artifact copied into the target. A move also sendsartifact.deletedfor each source artifact. - Audit: one
artifact.copyorartifact.moveevent with the source, target and items, plus the per-repository upload and delete events the handlers already write. - Federation: the target's federation log picks up the new rows as it does for a promotion.
- Metadata of the target (and of the source on move) is regenerated through
RegenQueue, as for a promotion. Groups containing either repository follow.
oa and UI
oa cp <source> <target> <package>@<version> [--dry-run] [--force]andoa mv, which also accept--sha256and--path.- On the artifact page, "Copy to…" and "Move to…" list the hosted repositories of the same format that the user can write.
Out of scope
- Copying out of a proxy cache into a hosted repository ("adopt an upstream artifact"). The promoter reads the generic tables of hosted repositories, while the proxy cache is stored differently, and adopting an upstream artifact raises curation questions of its own.
- Copying between formats, or into proxy or group repositories (the same errors as promotion:
ErrFormatMismatch,ErrNotHosted). - Copying a whole repository or a path prefix. A list of items covers that, and a prefix selector can be added later.
Questions for the maintainer
- Properties: should a copy carry the artifact's properties? Promotion does not copy them today, as far as I can see. I would copy them, since keeping them is part of the reason to copy instead of re-uploading.
- Scan results: copy them, or let the target rescan? OSV matching applies to the target anyway when the mirror is on. Content scans (secrets, image layers) would otherwise need to be run again by hand.
created_at: a promotion dates the copied rows now (clock_timestamp(), so conan's "latest" sees a promoted file as newest). For copy that seems right too: the target's cleanup policies count from when the file arrived. Is there a reason to keep the source's upload time instead, for example so move looks like nothing happened?- Route shape: two routes (
/copy,/move) or one (/transferwith"mode")?
Once the design is agreed, I'm happy to implement it, starting with the API and oa, with the UI in a second PR.
Activity
M0Rf30 commentedon Nov 27, 2026
Thanks, this fills a real gap. I'm implementing it for 0.26.0, API,
oa cp/oa mvand the UI together, on top ofinternal/promoteas you describe. A PR will link here.Answers to your questions:
created_at: now (clock_timestamp()) for both copy and move, as promotion does, so the target's cleanup policies count from arrival and conan's "latest" stays consistent.POST /api/v1/repositories/{source}/copyand.../move.The rest follows the proposal: one transaction for all items,
dry_run, admin-onlyforce(replaced files go to the target's trash), move sends the source files to the source's trash, and a source held by a sealed bundle or immutable releases answers409. AuthZ is checked per repository in the handler (copy:readon the source paths andwriteon the target; move addsdeleteon the source), notmanage, so a scoped CI token can promote between its two repositories.