Skip to content

Repository Commands

Scan, build and verify a repository of qcow2 images, with optional metadata in repo.yaml.

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

barn repo scan /srv/barn     # inspect the files under images/
barn repo build /srv/barn    # write catalog.json
barn repo verify /srv/barn   # compare the catalog with the images and optional metadata

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

barn repo scan <root> [flags]

Report the state of every qcow2 file without changing anything or needing qemu-img:

StateMeaning
trackedSelected by filename inference or repo.yaml, and present
missingReferenced by repo.yaml but absent from images/
untrackedPresent in images/ but not referenced by repo.yaml
unsafeNot 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 --json repo scan /srv/barn | jq -e '(.missing + .unsafe) | length == 0'

barn repo build

barn repo build <root> [flags]

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 build /srv/barn
barn --json repo build /srv/barn

barn repo verify

barn repo verify <root> [flags]

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.

barn repo verify /srv/barn
barn --json repo verify /srv/barn

Implementation

The self-hosted repository guide gives a two-command example.