system_imaging.diskimage_from_oras#
Create a disk image from an oras:// artifact#
Materializes the qcow2 disk-image for system-imaging entries that declare an
oras source, such as nosi guest-images published to an OCI registry:
[system-imaging.images.ubuntu-2604-x86_64]
oras.url = "oras://ghcr.io/safl/nosi/ubuntu-2604-headless@sha256:<digest>"
disk.path = "{{ local.env.HOME }}/system_imaging/disk/ubuntu-2604-x86_64.qcow2"
oras artifacts have no stable download URL, so the reference is resolved with the
withcache oras adapter (the anonymous bearer-token flow) to a registry blob URL
plus an auth header. The blob is pulled with curl, which retries and resumes,
then decompressed and converted to the qcow2 at disk.path. A withcache curl
shim, if one is configured in the environment, caches the transfer transparently.
The pull is skipped when the pinned image is already staged, keyed on the content
digest recorded in a stamp next to the qcow2; bumping the digest in the config
re-stages. A tag, oras://...:v1.2.3, is keyed on the digest it resolves to,
so it is pulled once, and again only when the tag is moved. Without the
registry, a staged tag is used only if it was staged from that same reference,
which is kept next to the qcow2 too.
The qcow2 is grown by disk.grow (default 8G) beyond the image, as
headroom the guest’s rootfs grows into at boot; a guest that builds large
software in place asks for more, disk.grow = "32G". A size other than the
default is kept in the stamp too, so changing it re-stages.
Restrict which images are built with a case-insensitive fnmatch pattern:
with:
pattern: "ubuntu-2604*"
Retargetable: False#
This script only runs on the initiator; it writes to the local filesystem.
- cijoe.system_imaging.scripts.diskimage_from_oras.diskimage_from_oras(cijoe, image: dict)#
Resolve the oras source, pull it, and convert it to the disk image
- cijoe.system_imaging.scripts.diskimage_from_oras.main(args, cijoe)#
Build disk images for system-imaging entries with an oras source
- cijoe.system_imaging.scripts.diskimage_from_oras.staged(digest: str, grow: str) str#
What the stamp of an image staged from ‘digest’, grown by ‘grow’, holds; the default growth is left out, so stamps written before it was configurable hold
CLI arguments#
--pattern PATTERNPattern for image names to build (default: None)