Repository Commands
2 minute read
A static repository has a flat images/ directory and a generated catalog.json. In 1.5.0, barn repo build reads names, versions and architectures from filenames. Add repo.yaml for aliases, channels, nonstandard names or different boot settings. Build a static repository · Repository format
All three have been available since 1.1.0. Each takes one repository root and has no options beyond the global options.
barn repo scan
Report the state of every qcow2 file without changing anything or needing qemu-img:
| State | Meaning |
|---|---|
tracked | Selected by filename inference or repo.yaml, and present |
missing | Referenced by repo.yaml but absent from images/ |
untracked | Present in images/ but not referenced by repo.yaml |
unsafe | Not a safe regular qcow2 file |
--json returns root and the four arrays. The scan exits 0 whenever it completes, even with findings, so a script must check missing and unsafe itself:
barn repo build
Inspect selected images with qemu-img and atomically write catalog.json with the final digests and sizes. A supplied repo.yaml controls selection. A missing or unsafe declared artifact fails the build.
With an explicit revision, increase it when the catalog changes. With the revision omitted, Barn assigns it automatically and preserves the previous bytes on an unchanged rebuild. Upload immutable images before publishing the catalog. Signing and trust rules
barn repo verify
Rebuild the catalog in memory from the filenames, optional repo.yaml and actual image bytes, and require a byte-for-byte match with the existing catalog.json. Requires qemu-img. Run it before publishing or after copying a repository. It checks consistency only; clients check signatures when they activate the catalog.
Implementation
The self-hosted repository guide gives a two-command example.