diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-05-10 13:58:45 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-05-10 13:58:45 +0000 |
| commit | cbe004439cae170ad5455fbb881495795e42bf5a (patch) | |
| tree | 540a4ef020ede79fa8b4d22e5ce3091fc4ceba92 /docs | |
| parent | af92db59a7d2367528bc86cb37d969e87ef36659 (diff) | |
| download | meta-virtualization-cbe004439cae170ad5455fbb881495795e42bf5a.tar.gz | |
container-registry: add multi-arch OCI push support and tests
The registry push script (container-registry-index.bb) treated all OCI
directories as single-arch, calling 'skopeo copy oci:<dir>' which fails
with "more than one image in oci, choose an image" when the directory
contains a multi-arch image index. The original push implementation
predated multi-arch OCI support and only handled the single-manifest
case.
Detect multi-arch OCI Image Index directories (both flat and nested
layouts) in the direct-path push mode and use 'skopeo copy --all' to
push the entire manifest list to the registry in one operation. This
preserves the multi-platform structure so that clients pulling from the
registry automatically get the correct architecture.
Also strip the '-multiarch' suffix from directory names when deriving
the registry image name, so container-base-multiarch-multiarch-oci
pushes as 'container-base' rather than 'container-base-multiarch'.
Add build-profiles.md documentation for the vcontainer distro, container
multiconfigs, and multi-arch container build workflow.
Add test_vcontainer_distro.py with 54 tests across three tiers:
- Tier 1: Static file assertions (vruntime-base.inc, vcontainer.conf,
multiconfigs, bbclass defaults, recipe structure)
- Tier 2: Cross-file consistency (shared base, distro-MC alignment,
bbclass-to-multiconfig file matching)
- Tier 3: Build output verification (OCI index structure, platform
entries, blob integrity, manifest validation)
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/build-profiles.md | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/docs/build-profiles.md b/docs/build-profiles.md index 602d11b9..15c4a9cf 100644 --- a/docs/build-profiles.md +++ b/docs/build-profiles.md | |||
| @@ -17,9 +17,21 @@ meta-virt-host.conf <- base (always required first) | |||
| 17 | container-host-containerd.conf | 17 | container-host-containerd.conf |
| 18 | container-host-k3s.conf | 18 | container-host-k3s.conf |
| 19 | container-host-k3s-node.conf | 19 | container-host-k3s-node.conf |
| 20 | container-host-incus.conf | ||
| 20 | xen-host.conf <- Xen support (composable) | 21 | xen-host.conf <- Xen support (composable) |
| 21 | meta-virt-dev.conf <- QEMU dev settings (opt-in) | 22 | meta-virt-dev.conf <- QEMU dev settings (opt-in) |
| 22 | container-registry.conf <- registry config (opt-in) | 23 | container-registry.conf <- registry config (opt-in) |
| 24 | |||
| 25 | Distro configs: | ||
| 26 | vruntime.conf <- minimal VM rootfs (BBMASK, busybox init) | ||
| 27 | vcontainer.conf <- OCI image builder (no BBMASK, full packages) | ||
| 28 | both share: vruntime-base.inc <- stripped DISTRO_FEATURES, opted-out features | ||
| 29 | |||
| 30 | Multiconfigs (set by meta-virt-host.conf): | ||
| 31 | vruntime-aarch64 <- vdkr/vpdmn VM rootfs builds | ||
| 32 | vruntime-x86-64 | ||
| 33 | container-aarch64 <- OCI container image builds | ||
| 34 | container-x86-64 | ||
| 23 | ``` | 35 | ``` |
| 24 | 36 | ||
| 25 | ## Quick Start | 37 | ## Quick Start |
| @@ -80,7 +92,11 @@ The foundation for all virtualization work. Must be included first. | |||
| 80 | **Sets:** | 92 | **Sets:** |
| 81 | - `DISTRO_FEATURES:append = " virtualization systemd seccomp vmsep vcontainer"` | 93 | - `DISTRO_FEATURES:append = " virtualization systemd seccomp vmsep vcontainer"` |
| 82 | - `PREFERRED_PROVIDER_virtual/runc ?= "runc"` | 94 | - `PREFERRED_PROVIDER_virtual/runc ?= "runc"` |
| 83 | - `BBMULTICONFIG ?= "vruntime-aarch64 vruntime-x86-64"` | 95 | - `BBMULTICONFIG ?= "vruntime-aarch64 vruntime-x86-64 container-aarch64 container-x86-64"` |
| 96 | |||
| 97 | The `vruntime-*` multiconfigs use the `vruntime` distro (BBMASK for minimal VM | ||
| 98 | rootfs). The `container-*` multiconfigs use the `vcontainer` distro (no BBMASK, | ||
| 99 | full OCI tooling available) for building multi-arch container images. | ||
| 84 | 100 | ||
| 85 | **Use standalone** for custom/mixed configurations where you want to set | 101 | **Use standalone** for custom/mixed configurations where you want to set |
| 86 | CONTAINER_PROFILE and other variables manually. | 102 | CONTAINER_PROFILE and other variables manually. |
| @@ -174,6 +190,54 @@ CONTAINER_REGISTRY_SECURE = "1" | |||
| 174 | CONTAINER_REGISTRY_USERNAME = "myuser" | 190 | CONTAINER_REGISTRY_USERNAME = "myuser" |
| 175 | ``` | 191 | ``` |
| 176 | 192 | ||
| 193 | ## Multi-Architecture Container Images | ||
| 194 | |||
| 195 | The `container-aarch64` and `container-x86-64` multiconfigs build OCI | ||
| 196 | container images using the `vcontainer` distro. This distro shares the same | ||
| 197 | stripped `DISTRO_FEATURES` as `vruntime` (via `vruntime-base.inc`) but | ||
| 198 | without the BBMASK that blocks OCI tooling like umoci. | ||
| 199 | |||
| 200 | ### Build Commands | ||
| 201 | |||
| 202 | ```bash | ||
| 203 | # Single-arch container image | ||
| 204 | bitbake mc:container-x86-64:container-base | ||
| 205 | |||
| 206 | # Multi-arch OCI Image Index (aarch64 + x86_64) | ||
| 207 | bitbake container-base-multiarch | ||
| 208 | |||
| 209 | # Import into vdkr (auto-selects host platform) | ||
| 210 | vdkr vimport tmp/deploy/images/*/container-base-multiarch-multiarch-oci container-base:latest | ||
| 211 | ``` | ||
| 212 | |||
| 213 | ### Custom Multi-Arch Recipes | ||
| 214 | |||
| 215 | Create a recipe that inherits `oci-multiarch`: | ||
| 216 | |||
| 217 | ``` | ||
| 218 | # myapp-container-multiarch.bb | ||
| 219 | SUMMARY = "Multi-arch myapp container" | ||
| 220 | LICENSE = "MIT" | ||
| 221 | |||
| 222 | inherit oci-multiarch | ||
| 223 | |||
| 224 | OCI_MULTIARCH_RECIPE = "myapp-container" | ||
| 225 | OCI_MULTIARCH_PLATFORMS = "aarch64 x86_64" | ||
| 226 | ``` | ||
| 227 | |||
| 228 | The `myapp-container.bb` recipe must inherit `image-oci` and produce OCI output. | ||
| 229 | |||
| 230 | ### vcontainer vs vruntime | ||
| 231 | |||
| 232 | | | vruntime | vcontainer | | ||
| 233 | |--|----------|------------| | ||
| 234 | | **Purpose** | VM rootfs for vdkr/vpdmn | OCI container images | | ||
| 235 | | **BBMASK** | Yes (minimal) | No (full packages) | | ||
| 236 | | **Init** | busybox | (per recipe) | | ||
| 237 | | **IMAGE_FSTYPES** | ext4 | (per recipe) | | ||
| 238 | | **Multiconfigs** | vruntime-aarch64, vruntime-x86-64 | container-aarch64, container-x86-64 | | ||
| 239 | | **Shared base** | vruntime-base.inc | vruntime-base.inc | | ||
| 240 | |||
| 177 | ## Design Notes | 241 | ## Design Notes |
| 178 | 242 | ||
| 179 | **Profiles are pure deltas.** They do not include `meta-virt-host.conf` | 243 | **Profiles are pure deltas.** They do not include `meta-virt-host.conf` |
