Image Pipeline
5 minute read
This page is for contributors who build Barn’s official Linux images; if you only use images, skip it. To share images of your own, build a static repository instead.
The tools live under packaging/image-pipeline/ in the Barn source checkout. build.sh turns one downloaded qcow2 with a known SHA-256 into a testing candidate bundle, either validated as it is or normalized offline; build-official.py runs it over the official matrix and assembles a candidate repository. The builder needs no network access or signing keys and leaves Barn’s runtime state alone. Its output then goes through live smoke tests and release review.
- Tools: Python 3 and
qemu-img;offlinemode also needs workinglibguestfstools (virt-customize,virt-cat). Override them with--qemu-img,--virt-customize, and--virt-cat, or withQEMU_IMG,VIRT_CUSTOMIZE, andVIRT_CAT. - Storage: keep source images, RPM/DEB package caches, and output directories outside the Git working tree, which tracks only recipes and lockfiles.
- Architecture:
--archrecords the target architecture in the metadata; runofflinecustomization wherelibguestfscan execute that architecture.
Modes and profiles
validatecopies and re-hashes the source, checks that it is a single-fileqcow2withqemu-img check, and writes an evidence bundle without touching guest files or credentials.offlinenormalizes guest access on a staged copy withvirt-customize --no-networkandvirt-cat: it confirms UID/GID88is free of unrelated accounts, configures the lockeddba/adminidentity, disables SSH password and root login, strips SSH host keys, shell history, machine-id, andcloud-initcaches, restores SELinux labels, and reads back a deterministic guest marker.
The profile adds distribution-specific steps; build.sh defaults to --profile base:
| Profile | Normalization steps | Package inputs |
|---|---|---|
base | Account, sudo, SSH, and cloud-init normalization only | None (package flags rejected) |
el8 | Base normalization plus Python 3, SSH drop-in include, legacy network cleanup, chronyd, and SELinux relabeling | Locked RPM dependency set |
el9 | Base normalization plus legacy network cleanup and SELinux relabeling | None (package flags rejected) |
el10 | Base normalization plus signed kernel-modules and kernel-modules-extra matching kernel-core, Docker bridge/iptables/overlay module verification, and SELinux relabeling | Locked RPM dependency set |
d12, d13 | Base normalization plus offline XFS userspace tools and en_US.UTF-8 / C.UTF-8 locale setup | Locked DEB dependency set |
validate accepts only --profile base. In offline mode, el8, el10, d12, and d13 require --package-lock and --package-cache matching the profile and architecture; build-official.py supplies both for official targets.
Official candidate matrix
build-official.py builds the ten official targets, Debian 12 and 13 (d12, d13) and Rocky Linux 8, 9, and 10 (el8, el9, el10), each on amd64 and arm64, from the upstream URLs, package locks, release versions, SHA-256 digests, and SOURCE_DATE_EPOCH pinned in official-v1.json. --list prints what your checkout pins. Ubuntu artifacts come from the same recipe run directly by pipeline.py, and need no offline package lock because Ubuntu cloud images already ship xfsprogs. Debian source inspection and candidate tests · Rocky Linux image tests
Create --source-cache, --package-cache, and --output beforehand and pass canonical absolute paths. --fetch downloads missing pinned HTTPS inputs and verifies their SHA-256 before virt-customize --no-network runs; without it, every locked input must already be cached. Omit --target to build all ten, or repeat it for a subset.
Once all ten bundles exist, assemble a candidate static repository from the parent directory that holds them, repeating --assemble-from for bundles spread over several parents:
Assembly requires exactly one bundle per target and a new --output path that does not exist yet. It runs barn repo build and barn repo verify with the barn on PATH or --barn /absolute/path/to/barn. The result maps channels to candidate (for example d13:candidate) with status testing, ready for live VM acceptance before promotion to stable and supported.
Validate a single downloaded image
--source must be a canonical absolute path to a regular file, not a symlink, of at most 16 GiB; that cap is the recipe’s, while Barn checks runtime images against their catalog size (local import). --output must be a new path in an existing directory. The builder takes an adjacent lockfile, stages in a 0700 temporary directory, and renames the finished bundle into place; on failure it removes only its staging directory.
Each completed bundle contains:
| File | Purpose |
|---|---|
<name>-<release>-<arch>-<digest-prefix>.qcow2 | Validated read-only candidate qcow2 image |
build-recipe.json | Builder invocation, tool versions, and input digests |
manifest-candidate.json | Unsigned candidate metadata (status: "testing") |
provenance.intoto.json | SLSA build provenance statement |
sbom.spdx.json | SPDX software bill of materials covering declared pipeline inputs and injected packages |
validation.json | Before/after qcow2 checks, normalization marker results, and pending release gates |
checksums.txt | SHA-256 checksums of the other files in the bundle |
package-lock.json | Included when the profile installs locked RPM/DEB packages |
Promote a candidate
With fixed inputs and tool versions, validate mode is byte-for-byte reproducible; for offline mode, build the candidate twice and compare the bundles as release evidence. To promote a candidate to a public supported release:
- Run live VM smoke tests across the target host and guest combinations.
- Update
repo.yamlwith the new catalogrevisionandsupportedstatus. - Run
barn repo buildandbarn repo verify. - Sign
catalog.jsonand publish its detached signature ascatalog.json.minisig. - Verify the published repository endpoints.