Importing from another registry
Copy every version of chosen packages from an npm registry, a NuGet feed or an Ansible Galaxy into a local repository.
quader admin import is a client of both registries: it reads the old one as a package manager does and publishes to Quader through
the format's own protocol. It needs no database and no access to Quader's storage, so it runs on a workstation, in a pod or as a Job.
Quader checks an imported version as any publish: the token's permissions, the digest, the rule that a stored version never changes,
the audit event, the vulnerability evaluation and the quota.
Before you start
- Who
- whoever holds a token with
readanddeployon the target repository; a service account is the right owner - Formats
- npm, NuGet, Ansible Galaxy (collections)
- A local repository of the format, with the settings imported packages should have (Managing repositories).
- A Quader token that may publish there (Managing tokens). A token with only
readdoes a dry run. - A route to the old registry and to Quader. Both addresses pass the egress address policy of remote repositories: a private registry
needs its range in
allow_cidrs, and a private CA inca_files(proxy.outbound).
Run it
Put the tokens in files only you can read; they are never taken as arguments. Name the packages in a file, one per line (a line that
starts with # is skipped). Look first, then run with a state file and a report:
umask 077
printf '%s' "$QUADER_TOKEN" > quader-token # example
printf '%s' "$OLD_REGISTRY_TOKEN" > source-token # example
quader admin import npm \
--from https://registry.old.example.com/ \
--to https://quader.example.com/api/npm/web/npm-local/ \
--packages-file packages.txt \
--source-auth bearer --source-password-file source-token \
--token-file quader-token --dry-run # example
quader admin import npm ... --state import.state --report import-report.json
--to is the repository's client address. For NuGet both addresses are the service indexes (…/v3/index.json). For Ansible Galaxy
--from is the old Galaxy's API root ending in /api/, with any content/<repository>/ prefix it serves under; the command does not
guess it, so run --dry-run first.
| Flag | What it does | Default |
|---|---|---|
--package, --packages-file |
The packages to copy (Ansible: <namespace>.<name>) |
none |
--search <text> |
Also what the old registry's search finds; --search '' copies every Galaxy collection |
none |
--source-auth |
none, basic, bearer, or token for a Galaxy server's API token |
none |
--source-username, --source-password-file |
The old registry's account; also QUADER_IMPORT_SOURCE_PASSWORD |
none |
--source-extra-host |
A further host serving the registry's files, such as a CDN; it gets no credential | none |
--token-file |
The Quader token; also QUADER_IMPORT_TOKEN |
none |
--state, --report |
The state file; the report as JSON (mode 0600) | none |
--concurrency, --rate |
Packages at once; requests per second to the old registry (0 no limit) |
2, 5 |
--max-package-bytes |
The largest file taken | 536870912 |
--spool-dir, --dry-run |
Where a file waits before its publish; read and report only | the temporary directory, off |
In a Kubernetes Job, use Quader's image with the pods' configuration (--config), mount the tokens from Secrets, and keep the state
file on a volume.
What is copied
| From the old registry | Copied |
|---|---|
Every version's files; npm manifests and READMEs; NuGet .nuspec metadata; Galaxy collection archives |
Yes |
| npm dist-tags | Yes, after the versions, latest last; a tag of a version not copied is reported |
| NuGet unlisted state | Only where the repository's delete mode is unlist (or unset), with a token that may read its configuration |
| Publication times | No: the order stays, the dates are the import's |
| Deprecations, npm provenance | No; listed under "not kept" |
| Galaxy signatures and namespace metadata | No |
| Galaxy roles | No; the report counts them. Publish a role inside a collection |
| Owners, download counts, users and tokens | No; the token's principal owns what it publishes |
Each file is compared with the strongest digest the registry announces before a byte is sent: a mismatch is digest_mismatch, a missing
digest no_digest, with no switch to import it anyway. The command never overwrites: other content under a stored version is a
conflict.
The report
One line per package while it runs; at the end every conflict and failure, what was not kept, and the totals. The outcomes are
imported, skipped (identical content), conflict, failed and, in a dry run, would_import.
| Code | Cause | Action |
|---|---|---|
digest_mismatch |
Not the file the registry announced | Check the registry and the network, run again |
no_digest |
The registry announced none | Publish that version by hand |
foreign_host |
The file is on an unlisted host | Add --source-extra-host if you trust it |
identity_mismatch |
The package names another name or version | Check the old registry |
too_large |
Over --max-package-bytes |
Raise it |
source_error |
The old registry did not answer as a registry, or lacks the package | Check --from with --dry-run |
forbidden |
Quader refused the publish with 403 | Grant the token deploy on that name |
target_refused |
Quader refused otherwise; the detail has its status and code | See Error codes |
invalid_name |
Not a package name of the format | Fix the name |
state_not_set |
The versions are in, a dist-tag or the listing is not | Run again |
Exit status 0 is complete, 1 needs a look or was stopped, 2 a wrong command line. One package's failure stops no other; 401
(token refused) and 507 (Quader full) stop the run. Every version is an ordinary publish in the audit log, by the token's principal.
Run it again, resume a cut run
Running the same command again is safe: a stored identical version is skipped and writes nothing, a version cut in transit was never
stored and is published now. --state only makes it cheaper: packages it lists as complete are not read again and are marked
resumed in the JSON report. A state file belongs to one format, source and target; a dry run neither reads nor writes it. SIGINT
and SIGTERM cancel the request in flight and exit 1 with the report.
The old registry gets at most --rate requests per second. On 429 or 503 the command waits as Retry-After says (at most two
minutes), tries a request at most five times, and halves its rate for the rest of the run (2 per second when it had no limit).
Note
The credentials are read from files or the environment and written nowhere. The old registry's goes to its own address only, never to
a redirect target or an extra host. The command publishes every name the token may publish, so give it deploy on the target alone.