From 8a9777cb81b73cd89d6723577cb6374058e36c03 Mon Sep 17 00:00:00 2001 From: Charalampos Mainas Date: Tue, 17 Nov 2026 14:35:05 +0100 Subject: [PATCH 1/2] feat(bundle): Carry hull, built from a pinned commit brig is to drive Linux sandboxes through hull, as it does on macOS (brig-sh/hull#105). hull on Linux is a containerd client that boots through urunc, so it needs this bundle's urunc, monitors and guest assets, but hull publishes no Linux release to fetch. So the build makes it from brig-sh/hull at a pinned commit, the way it makes urunc: fetched by SHA, refused if the checkout is anything else, recorded in pins.env as HULL_REF and HULL_PINNED, and checked by CI. hull is pure Go, so it is a static cross compile with no telemetry endpoint. stock leaves it out, as it leaves out hvi. Unlike urunc, hull is fetched with its history and tags, not one commit deep. Go derives hull's version from the nearest v* tag, and a shallow checkout reads v0.0.0--, which brig takes for a hull older than 0.1.0-rc23: it would stop pinning boot images by digest. CI fails a bundle whose hull reports v0.0.0. nerdctl stays, and stays brig's runtime: the brig this bundle carries drives only nerdctl on Linux, and brig refuses an egress policy, a route, an isolated network and a published port on hull on Linux, so the shipped profiles would not run there yet. BRIG_RUNTIME=hull opts in. Two launcher changes make that opt-in work. BRIG_RUNTIME_BIN now follows BRIG_RUNTIME: it was always the bundle's nerdctl, and brig handed that path with BRIG_RUNTIME=hull drives nerdctl with hull's command line. A bundle without hull names no binary for it. A BRIG_RUNTIME_BIN that names one of the bundle's runtimes was left by an earlier source of the launcher, so it is worked out again for the runtime set now; any other value is the caller's and stands. A shell that has evaled brig-ctl env runs brig itself, not the launcher, so the README says to set BRIG_RUNTIME before the eval. And the launcher exports NETCONFPATH, the directory nerdctl.toml names. hull finds the bundle's network on its own at the default install prefixes, but reads the variable in preference, so the export keeps hull and nerdctl on one directory, an install at another prefix included. hull's pin follows urunc's: hull checks the urunc keys it writes against one urunc commit, read from its internal/urunckeys/go.mod, and the build refuses a hull written against another urunc, so the two pins cannot drift apart. hull 4bf76a6, the tip of main, checks against urunc 5c6bc70, so urunc moves there too: one commit on 3c00b69 that hands hvi a socket instead of a tap device and reads the three annotations hull writes for a run on a network gateway, so an hvi guest on Linux can join one. The feat/linux-hvi-v050 branch has moved to it. Its urunit.pin is the same, 48a61bd, so the initrd does not change, and hull-assets 0.1.12 is 0.1.11 rebuilt with 5c6bc70 recorded as its source, which check-assets.sh matches against the urunc built here. nix/urunc.nix follows the bundle's urunc; urunc's modules did not change, so its vendorHash stands. The README and docs no longer call the bundle's hvi the one hull ships on macOS: hull's hvi.pin names 0.1.0-rc.1, and hull does not check the bundle's. Signed-off-by: Charalampos Mainas --- .github/workflows/ci.yml | 56 +++++++++++++ DESIGN.md | 2 +- README.md | 51 ++++++++++-- docs/variants.md | 8 +- nix/urunc.nix | 6 +- scripts/build-bundle.sh | 173 ++++++++++++++++++++++++++++++++------- tests/check-assets.sh | 8 +- tests/source-pins.sh | 119 ++++++++++++++++++++++----- 8 files changed, 358 insertions(+), 65 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02cecb0..1f45392 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -174,6 +174,12 @@ jobs: grep -qx "URUNC_PINNED=true" "$p" || { echo "pins.env does not say URUNC_PINNED=true"; exit 1; } grep -qx "ASSETS_URUNC_REF=$want" "$p" \ || { echo "pins.env does not carry ASSETS_URUNC_REF=$want"; exit 1; } + # hull is built from a pinned commit the same way. + want="$(sed -n 's/^HULL_REF_DEFAULT=\([0-9a-f]\{40\}\)$/\1/p' scripts/build-bundle.sh)" + [ -n "$want" ] || { echo "no HULL_REF_DEFAULT in build-bundle.sh"; exit 1; } + grep -E "^HULL_(REF|PINNED)=" "$p" + grep -qx "HULL_REF=$want" "$p" || { echo "pins.env does not carry HULL_REF=$want"; exit 1; } + grep -qx "HULL_PINNED=true" "$p" || { echo "pins.env does not say HULL_PINNED=true"; exit 1; } # hvi is fetched from the release the script pins; fetch-hvi.sh # fails the build unless its signature and sums check out. grep -E "^HVI_(VERSION|COMMIT)=" "$p" @@ -193,6 +199,56 @@ jobs: grep -E "^URUNIT_(REPO|REF)=" "$p" grep -qx "URUNIT_REF=$want" "$p" || { echo "pins.env does not carry URUNIT_REF=$want, urunc's pin"; exit 1; } + # brig tells the Linux hull from the macOS one by the platform at the end + # of hull --version, and reads the version before it: a v0.0.0 hull, + # which a build without hull's tags gives, is one too old to pin boot + # images by digest. The launcher has to hand brig the binary of the + # runtime it asked for: nerdctl by default, hull when BRIG_RUNTIME=hull. + # The launcher is sourced as this runner's user, so a rootless bundle + # takes its non-root branch. + - name: Check hull and the launcher + run: | + set -eu + d="$(mktemp -d)" + tar -xzf "$(ls dist/*.tar.gz)" -C "$d" + t="$(echo "$d"/*)" + v="$("$t/bin/hull" --version)" + echo "$v" + case "$v" in + *"linux/${{ matrix.arch }})") ;; + *) echo "hull --version does not end in linux/${{ matrix.arch }}"; exit 1 ;; + esac + case "$v" in + "hull v0.0.0"*|"hull dev"*) echo "hull has no version from its tags"; exit 1 ;; + esac + # The tree is unpacked here, not at the prefix it was built for, and + # the launcher's paths name that prefix. + prefix="$(sed -n 's/^PREFIX=//p' dist/*.pins.env)" + launcher() { + env -i HOME="$HOME" PATH=/usr/bin:/bin "$@" \ + sh -c ". '$t/etc/brig-env.sh'; echo \"\$BRIG_RUNTIME \$BRIG_RUNTIME_BIN \$NETCONFPATH\"" + } + case "${{ matrix.rootless }}" in + rootless) net="$HOME/.config/brig/cni/net.d" ;; + *) net="$prefix/etc/cni/net.d" ;; + esac + got="$(launcher)" + [ "$got" = "nerdctl $prefix/bin/nerdctl $net" ] \ + || { echo "default launcher: got '$got'"; exit 1; } + got="$(launcher BRIG_RUNTIME=hull)" + [ "$got" = "hull $prefix/bin/hull $net" ] \ + || { echo "BRIG_RUNTIME=hull launcher: got '$got'"; exit 1; } + got="$(launcher BRIG_RUNTIME=hull BRIG_RUNTIME_BIN=/opt/hull NETCONFPATH=/opt/net)" + [ "$got" = "hull /opt/hull /opt/net" ] \ + || { echo "the launcher overrode the caller's values: got '$got'"; exit 1; } + # Sourced again after a switch of runtime, as a second eval of + # brig-ctl env does, the launcher drops the binary it set the first + # time and names the new runtime's. + got="$(env -i HOME="$HOME" PATH=/usr/bin:/bin \ + sh -c ". '$t/etc/brig-env.sh'; BRIG_RUNTIME=hull; . '$t/etc/brig-env.sh'; echo \"\$BRIG_RUNTIME \$BRIG_RUNTIME_BIN\"")" + [ "$got" = "hull $prefix/bin/hull" ] \ + || { echo "the launcher re-sourced for hull kept nerdctl: got '$got'"; exit 1; } + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: bundle-${{ matrix.arch }}-${{ matrix.rootless }} diff --git a/DESIGN.md b/DESIGN.md index 273a822..78db22d 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -35,7 +35,7 @@ now done and is what `install.sh` and `scripts/build-bundle.sh` produce. - **Why urunc is built (at release).** Most components are upstream release artifacts, hvi among them (`brig-sh/hvi-vmm` `v0.1.0-rc.2`, cosign-verified). urunc has no release that carries what brig needs, so the build compiles it - from `urunc-dev/urunc` at commit `3c00b69`, on `feat/linux-hvi-v050` (CGO + from `urunc-dev/urunc` at commit `5c6bc70`, on `feat/linux-hvi-v050` (CGO static, so native per arch under qemu/binfmt). The source is pinned to a commit, since a branch tip moves with every push. The README's build section says how to move the pin. diff --git a/README.md b/README.md index 67df06d..129eb08 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ $ sha256sum -c checksums.txt --ignore-missing data/ immutable, unpacked from the tarball: bin/ brig, brigd, brig-broker (from a brig release that carries it), urunc, containerd-shim-urunc-v2, containerd, ctr, - runc, nerdctl, cosign, oras, hvi, firecracker, + runc, nerdctl, hull, cosign, oras, hvi, firecracker, cloud-hypervisor, solo5-hvt, solo5-spt, brig-ctl, brig-pool-up, brig-uninstall.sh libexec/ virtiofsd @@ -186,6 +186,38 @@ $ curl -fsSL https://raw.githubusercontent.com/NOFireAI/brig-standalone-linux/ma [docs/rootless.md](docs/rootless.md) has the detail, including the two things that still need root once per host, and what a home install gives up. +### hull beside nerdctl + +nerdctl is brig's runtime here. The bundle also carries hull, the runtime brig +drives on macOS, built for Linux: a containerd client that boots the same urunc, +monitors and guest assets. `BRIG_RUNTIME=hull` selects it, and the launcher then +points brig at the bundle's hull rather than its nerdctl: + +```console +$ BRIG_RUNTIME=hull brig doctor +``` + +It needs a brig that drives hull on Linux, which the `v0.5.0` in this bundle +does not. Even then, hull on Linux boots a sandbox on the shared bridge or with +no network, and brig refuses what it cannot enforce there yet: an egress policy, +a route, `network: isolated` and a published port. The shipped agent profiles +ask for an isolated network, so they stay on nerdctl for now. Every value the +launcher sets still defers to the environment, so `BRIG_RUNTIME_BIN` points brig +at another hull. + +The launcher works out the binary each time it is sourced. A shell that has run +`eval "$(brig-ctl env)"` has the bundle's `bin/` first on its `PATH`, so `brig` +there is the binary itself and nothing sources the launcher again: set +`BRIG_RUNTIME` before the eval, or run the eval again after changing it. + +```console +# export BRIG_RUNTIME=hull +# eval "$(/var/lib/brig/data/bin/brig-ctl env)" +``` + +hull takes no snapshotter from the environment, so `CONTAINERD_SNAPSHOTTER` +reaches nerdctl only: hull uses the namespace's default unless brig passes one. + ## Driving the runtime by hand `brig-ctl` wraps the private stack for when you want `ctr` or `nerdctl` @@ -280,14 +312,15 @@ the install does not. Running `build-bundle.sh` by hand to cross-build the other architecture needs qemu/binfmt instead of a native runner. `build-bundle.sh` fetches the components that have upstream releases and builds -urunc, which has none: +urunc and hull, which have none for Linux: | Component | Source | In the tarball | | --- | --- | --- | | brig, brigd, brig-broker | `brig-sh/brig` release | fetched, verified against its signed `checksums.txt` | -| urunc, containerd-shim-urunc-v2 | built from `urunc-dev/urunc` at commit `3c00b69` (branch `feat/linux-hvi-v050`) | CGO-static, built in a Go container | -| hvi | `brig-sh/hvi-vmm` release `v0.1.0-rc.2` (commit `2ed8f61`), the one hull ships on macOS | fetched, musl-static; its `SHA256SUMS` cosign-verified against hvi-vmm's release workflow, the tarball pinned by sha256 | -| guest kernel, container-initrd | `ghcr.io/nofireai/hull-assets` `0.1.11` | fetched by digest once its cosign signature checks out; the initrd is urunit. urunc's `packaging/container-initrd/urunit.pin` names `48a61bd`; hull-assets `0.1.11` does not record its urunit, so the bundle records that commit as `urunit_expected`. The build refuses a hull-assets bundle built from another urunc | +| urunc, containerd-shim-urunc-v2 | built from `urunc-dev/urunc` at commit `5c6bc70` (branch `feat/linux-hvi-v050`) | CGO-static, built in a Go container | +| hull | built from `brig-sh/hull` at commit `4bf76a6` (branch `main`), which publishes no Linux release | static (`CGO_ENABLED=0`), built in a Go container, with no telemetry endpoint | +| hvi | `brig-sh/hvi-vmm` release `v0.1.0-rc.2` (commit `2ed8f61`); hull pins its own hvi for macOS (`hvi.pin`) and does not check this one | fetched, musl-static; its `SHA256SUMS` cosign-verified against hvi-vmm's release workflow, the tarball pinned by sha256 | +| guest kernel, container-initrd | `ghcr.io/nofireai/hull-assets` `0.1.12` | fetched by digest once its cosign signature checks out; the initrd is urunit. urunc's `packaging/container-initrd/urunit.pin` names `48a61bd`; hull-assets `0.1.12` does not record its urunit, so the bundle records that commit as `urunit_expected`. The build refuses a hull-assets bundle built from another urunc | | monitors, virtiofsd | `urunc-dev/monitors-build` | fetched, pinned by sha256 | | containerd, runc, nerdctl, CNI | upstream releases | fetched, upstream checksums | | cosign | `sigstore/cosign` | fetched, pinned by sha256 | @@ -341,6 +374,14 @@ A branch given without a ref is refused, since it is unclear which of the two was meant. A tip build also has to match the guest assets (below), so it fails unless `ASSETS_VERSION` names a hull-assets release built from that tip. +hull is pinned the same way, with `HULL_REF_DEFAULT` and `HULL_BRANCH_DEFAULT`, +recorded in `pins.env` as `HULL_REF` and `HULL_PINNED`, and `HULL_REF` and +`HULL_BRANCH` work as their urunc counterparts do. The two pins move together: +hull on Linux writes urunc's annotations, and hull checks them against one urunc +commit (its `internal/urunckeys`), which has to be this bundle's urunc. The +build reads that commit from the hull checkout and refuses a hull written against +another urunc. + ### The initrd comes from hull-assets, checked against urunc brig execs into a guest through the exec agent in urunit, whose wire protocol diff --git a/docs/variants.md b/docs/variants.md index 95bf70d..aadd6e7 100644 --- a/docs/variants.md +++ b/docs/variants.md @@ -45,7 +45,7 @@ by `build-bundle.sh` and packed into the tarball. The installer just unpacks the No urunc release publishes a binary that boots a generic container. So the build compiles one, from `urunc-dev/urunc` at the commit `build-bundle.sh` pins -(`3c00b69`, on branch `feat/linux-hvi-v050`), in a +(`5c6bc70`, on branch `feat/linux-hvi-v050`), in a `golang:1.26.8` container: ```console @@ -161,12 +161,12 @@ refuses a stock binary, rather than printing a table of zeroes. 3. Settled: the guest kernel is fetched from `hull-assets`, by the same tags hull uses, and checked against its signature; the runtime is built from `urunc-dev/urunc` at a pinned commit - (`3c00b69`, on `feat/linux-hvi-v050`); and the initrd comes from the same + (`5c6bc70`, on `feat/linux-hvi-v050`); and the initrd comes from the same hull-assets bundle as the kernel, which the build refuses unless it was built from that urunc. urunc is pinned to a commit because a branch tip moves with every push; the README's build section says how to move it. -4. Settled: `build-bundle.sh` fetches hvi from the `brig-sh/hvi-vmm` release - hull ships on macOS (`v0.1.0-rc.2`). `scripts/fetch-hvi.sh` checks the +4. Settled: `build-bundle.sh` fetches hvi from a signed `brig-sh/hvi-vmm` + release (`v0.1.0-rc.2`). `scripts/fetch-hvi.sh` checks the cosign signature on its `SHA256SUMS`, the pinned sha256 of the tarball and the commit its manifest names. 5. Is `introspection` a variant at all, or `generic-boot` plus an opt-in flag? diff --git a/nix/urunc.nix b/nix/urunc.nix index ab79388..7344cd1 100644 --- a/nix/urunc.nix +++ b/nix/urunc.nix @@ -10,13 +10,13 @@ # commit is the one the bundle release records in its pins.env as URUNC_REF. buildGoModule (finalAttrs: { pname = "urunc"; - version = "0-unstable-2026-10-29"; + version = "0-unstable-2026-11-10"; src = fetchFromGitHub { owner = "urunc-dev"; repo = "urunc"; - rev = "3c00b69ff9ac1b8bb260975cdc63d18a7043558b"; - hash = "sha256-NbH+6nQWLEgcI2VBmtA/50EHbMB8Q1k4RJk67miYXtU="; + rev = "5c6bc7060d4f6d33b0d4e8fd388f9f04cc88510b"; + hash = "sha256-XKgvsGtmKeJfDAyDmJ4YtJyC4tkjTHv8nZEcWjKro2I="; }; vendorHash = "sha256-08PC8ethomYCZTBfP1PVCCXgXeyrSHHoozcVsWmqJUE="; diff --git a/scripts/build-bundle.sh b/scripts/build-bundle.sh index b2e16be..357c4bc 100755 --- a/scripts/build-bundle.sh +++ b/scripts/build-bundle.sh @@ -9,11 +9,12 @@ # The tarball is a complete /var/lib/brig/data tree: brig and brigd (and brig-broker, # from a brig release that carries it), cosign and oras, the # private-containerd stack (containerd, ctr, runc, nerdctl, CNI), the microVM -# monitors, the urunc runtime, the guest kernel and initrd, plus every config -# file, systemd unit, wrapper and the uninstaller. Most components are upstream -# release artifacts, hvi among them. The kernel and the initrd come from the -# signed hull-assets bundle. urunc is built here from urunc-dev/urunc, because -# no urunc release carries what brig needs. +# monitors, the urunc runtime, hull, the guest kernel and initrd, plus every +# config file, systemd unit, wrapper and the uninstaller. Most components are +# upstream release artifacts, hvi among them. The kernel and the initrd come +# from the signed hull-assets bundle. urunc is built here from urunc-dev/urunc, +# because no urunc release carries what brig needs, and hull from brig-sh/hull, +# which publishes no Linux release. # # scripts/build-bundle.sh --arch amd64 --version v0.1.0 --out dist # scripts/build-bundle.sh --arch arm64 --version v0.1.0 --variant generic-boot @@ -123,15 +124,30 @@ BRIG_REPO="${BRIG_REPO:-brig-sh/brig}" # records of urunc-dev/urunc#1111. The stack sits on urunc main as of # 89dfe8d, with the bind-mount fixes of urunc-dev/urunc#1150, and presses a # cloud-hypervisor guest's power button when its init cannot take the signal. +# Last, it hands hvi a socket instead of a tap device and reads the three +# annotations hull writes for a run on a network gateway, so an hvi guest on +# Linux can join one. URUNC_REPO="${URUNC_REPO:-urunc-dev/urunc}" URUNC_BRANCH_DEFAULT=feat/linux-hvi-v050 -URUNC_REF_DEFAULT=3c00b69ff9ac1b8bb260975cdc63d18a7043558b +URUNC_REF_DEFAULT=5c6bc7060d4f6d33b0d4e8fd388f9f04cc88510b URUNC_GO_IMAGE="${URUNC_GO_IMAGE:-golang:1.26.8}" +# hull: the runtime brig drives on macOS, here as a containerd client that boots +# through the urunc above. brig on Linux still drives nerdctl by default, and +# BRIG_RUNTIME=hull opts in, so the bundle carries both. hull publishes no Linux +# release, so it is built from source and pinned like urunc, with the same +# *_BRANCH and *_REF rules. hull checks the urunc keys it writes against one +# urunc commit (its internal/urunckeys), which must be URUNC_REF_DEFAULT: a +# urunc bump moves this pin to a hull that checks against the new commit. +HULL_REPO="${HULL_REPO:-brig-sh/hull}" +HULL_BRANCH_DEFAULT=main +HULL_REF_DEFAULT=4bf76a6335d55016e5b29f27eb169730d4a28f20 +HULL_GO_IMAGE="${HULL_GO_IMAGE:-golang:1.26.8}" # urunit, the one binary of the initrd, is not built here: the initrd comes from # hull-assets. pins.env records the urunit commit that urunc pins in # packaging/container-initrd/urunit.pin. -# hvi: the monitor brig boots a generic container on. It is the -# brig-sh/hvi-vmm release hull ships on macOS, static against musl. The tag, +# hvi: the monitor brig boots a generic container on. It is a signed +# brig-sh/hvi-vmm release, static against musl. hull pins its own hvi for +# macOS (hvi.pin) and does not check this one. The tag, # its commit and the sha256 of each tarball describe one release, so a bump # changes all four together. scripts/fetch-hvi.sh checks them. HVI_VERSION=0.1.0-rc.2 @@ -143,6 +159,9 @@ HVI_SHA256_LINUX_ARM64=3c11e3b1443fb9e39a652a0011ac74d548a7bd05674b6c4115ffbd5a0 if [ -n "${URUNC_BRANCH:-}" ] && [ "$URUNC_BRANCH" != "$URUNC_BRANCH_DEFAULT" ] && [ -z "${URUNC_REF+set}" ]; then fatal "URUNC_BRANCH=$URUNC_BRANCH is set but URUNC_REF is not. Set URUNC_REF= to build that branch's tip, or URUNC_REF= to build one commit from it." fi +if [ -n "${HULL_BRANCH:-}" ] && [ "$HULL_BRANCH" != "$HULL_BRANCH_DEFAULT" ] && [ -z "${HULL_REF+set}" ]; then + fatal "HULL_BRANCH=$HULL_BRANCH is set but HULL_REF is not. Set HULL_REF= to build that branch's tip, or HULL_REF= to build one commit from it." +fi if [ -n "${URUNIT_REF+set}" ] || [ -n "${URUNIT_BRANCH+set}" ] || [ -n "${URUNIT_REPO+set}" ]; then fatal "urunit is no longer built here: URUNIT_REPO, URUNIT_REF and URUNIT_BRANCH do nothing. The initrd comes from hull-assets; move ASSETS_VERSION to a release built from the urunit you want." fi @@ -151,14 +170,20 @@ if [ -n "${HVI_REF+set}" ] || [ -n "${HVI_BRANCH+set}" ]; then fi URUNC_BRANCH="${URUNC_BRANCH:-$URUNC_BRANCH_DEFAULT}" URUNC_REF="${URUNC_REF-$URUNC_REF_DEFAULT}" -# The checkout compares HEAD with the ref, so a ref is a full SHA: a short one, -# a tag or a branch name would never match. -if [ -n "$URUNC_REF" ]; then - case "$URUNC_REF" in - *[!0-9a-f]*) fatal "URUNC_REF='$URUNC_REF' is not a commit: pin a full 40-character SHA" ;; +HULL_BRANCH="${HULL_BRANCH:-$HULL_BRANCH_DEFAULT}" +HULL_REF="${HULL_REF-$HULL_REF_DEFAULT}" +# require_sha : the checkout compares HEAD with the ref, so a ref is +# a full SHA: a short one, a tag or a branch name would never match. An empty +# ref is a tip build, which pinned_note warns about. +require_sha() { + [ -n "$2" ] || return 0 + case "$2" in + *[!0-9a-f]*) fatal "$1='$2' is not a commit: pin a full 40-character SHA" ;; esac - [ "${#URUNC_REF}" -eq 40 ] || fatal "URUNC_REF='$URUNC_REF' is not a commit: pin a full 40-character SHA" -fi + [ "${#2}" -eq 40 ] || fatal "$1='$2' is not a commit: pin a full 40-character SHA" +} +require_sha URUNC_REF "$URUNC_REF" +require_sha HULL_REF "$HULL_REF" # The monitors and virtiofsd come from one monitors-build release. The release # is tagged vX.Y.Z and names its per-arch tarball after the monitor versions it # carries. monitors-build publishes no checksum file, so each tarball is pinned @@ -197,7 +222,7 @@ else fi ASSETS_REGISTRY="${ASSETS_REGISTRY:-ghcr.io}" ASSETS_REPO="${ASSETS_REPO:-nofireai/hull-assets}" -ASSETS_VERSION="${ASSETS_VERSION:-0.1.11}" +ASSETS_VERSION="${ASSETS_VERSION:-0.1.12}" # Who signs hull-assets: the identity brig checks before it boots a kernel from # there. The build checks the same one before it packs the kernel. ASSETS_SIGNER_DEFAULT='^https://github\.com/NOFireAI/hull-assets/\.github/workflows/build-assets\.yml@refs/heads/main$' @@ -960,22 +985,26 @@ verify() { fi } -# checkout_source : put github.com/ into -# at exactly the commit , or at the tip of when is empty, -# and print the commit it checked out. The commit is fetched by its SHA: a -# --depth 1 --branch clone stops containing a pinned commit as soon as the -# branch moves past it. GitHub serves any reachable commit by SHA, a pull -# request's head included. +# checkout_source [history]: put github.com/ +# into at exactly the commit , or at the tip of when +# is empty, and print the commit it checked out. The commit is fetched by its +# SHA: a --depth 1 --branch clone stops containing a pinned commit as soon as +# the branch moves past it. GitHub serves any reachable commit by SHA, a pull +# request's head included. The fetch is one commit deep, unless the fifth +# argument is "history": then it carries the commit's history and the +# repository's tags, for a build that derives its version from them. checkout_source() { cs_repo="$1"; cs_branch="$2"; cs_ref="$3"; cs_dir="$4" + cs_depth="--depth=1" + [ "${5:-}" = history ] && cs_depth="--tags" # stdout carries the commit and nothing else. git init -q "$cs_dir" >&2 git -C "$cs_dir" remote add origin "https://github.com/$cs_repo" >&2 if [ -n "$cs_ref" ]; then - git -C "$cs_dir" fetch -q --depth 1 origin "$cs_ref" >&2 \ + git -C "$cs_dir" fetch -q "$cs_depth" origin "$cs_ref" >&2 \ || fatal "could not fetch $cs_repo@$cs_ref" else - git -C "$cs_dir" fetch -q --depth 1 origin "refs/heads/$cs_branch" >&2 \ + git -C "$cs_dir" fetch -q "$cs_depth" origin "refs/heads/$cs_branch" >&2 \ || fatal "could not fetch the $cs_branch branch of $cs_repo" fi git -C "$cs_dir" -c advice.detachedHead=false checkout -q FETCH_HEAD >&2 @@ -1062,6 +1091,58 @@ if [ "$VARIANT" != "stock" ]; then info "urunit: urunc $URUNC_REF pins ${URUNIT_REPO:-urunit}@$URUNIT_REF" fi +# ---- hull: built from source (generic-boot / introspection) ------------------ +# stock leaves hull out, as it leaves out hvi: hull boots a plain image on hvi +# through the urunc built above, and stock ships a released urunc that knows +# neither. hull is pure Go (its release builds with CGO_ENABLED=0), so this is +# a cross compile in a container of the build host's arch, not a --platform +# build. No TELEMETRY_ENDPOINT is passed, so this hull never sends telemetry. +HULL_INSTALLED=false +HULL_PINNED="" +if [ "$VARIANT" != "stock" ]; then + command -v docker >/dev/null 2>&1 || fatal "docker is required to build hull from $HULL_REPO" + hsrc="$TMP_DIR/hull-src" + HULL_PINNED=true + [ -n "$HULL_REF" ] || HULL_PINNED=false + # hull's version is the one Go derives from the nearest v* tag, which + # needs the tags and the history down to them. One commit deep, it reads + # v0.0.0--, which brig takes for a hull older than + # 0.1.0-rc23: it would stop pinning boot images by digest. + h_commit="$(checkout_source "$HULL_REPO" "$HULL_BRANCH" "$HULL_REF" "$hsrc" history)" + pinned_note hull "$HULL_REPO" "$HULL_BRANCH" "$HULL_REF" "$h_commit" + HULL_REF="$h_commit" + # hull checks the urunc keys it writes against one urunc commit: the one + # its internal/urunckeys/go.mod requires, as a pseudo-version that ends in + # the commit's first 12 characters. A hull that checks against a urunc other + # than the one built above is refused, so the two pins move together. + h_keys="$hsrc/internal/urunckeys/go.mod" + [ -f "$h_keys" ] \ + || fatal "$HULL_REPO@$HULL_REF has no internal/urunckeys/go.mod: which urunc it was written against is unknown" + h_urunc_ver="$(awk '$1 == "require" { $1 = ""; sub(/^ +/, "") } + $1 == "github.com/urunc-dev/urunc" { print $2; exit }' "$h_keys")" + h_urunc="${h_urunc_ver##*-}" + case "$h_urunc_ver" in + *-*) ;; + *) fatal "$HULL_REPO@$HULL_REF requires urunc '$h_urunc_ver' in internal/urunckeys/go.mod, not a pseudo-version that names a commit" ;; + esac + case "$h_urunc" in + *[!0-9a-f]*) fatal "$HULL_REPO@$HULL_REF requires urunc '$h_urunc_ver' in internal/urunckeys/go.mod, not a pseudo-version that names a commit" ;; + esac + [ "${#h_urunc}" -eq 12 ] \ + || fatal "$HULL_REPO@$HULL_REF requires urunc '$h_urunc_ver' in internal/urunckeys/go.mod, not a pseudo-version that names a commit" + [ "$h_urunc" = "$(printf '%.12s' "$URUNC_REF")" ] \ + || fatal "$HULL_REPO@$HULL_REF checks the urunc keys against urunc $h_urunc, but this bundle carries urunc $URUNC_REF: move HULL_REF and URUNC_REF together" + info "hull: checks the urunc keys against urunc $h_urunc, the bundle's" + info "building hull $HULL_REF ($HULL_GO_IMAGE, linux/$ARCH)" + docker run --rm -v "$hsrc":/app -w /app -e HOME=/tmp -e CGO_ENABLED=0 "$HULL_GO_IMAGE" \ + sh -c "git config --global --add safe.directory /app && make linux LINUX_ARCH=$ARCH" \ + || fatal "hull build failed" + cp "$hsrc/dist/hull_linux_$ARCH" "$DL/hull" || fatal "the hull build left no dist/hull_linux_$ARCH" + chmod 0755 "$DL/hull" + HULL_INSTALLED=true + info " built hull $HULL_REF" +fi + # ---- brig + brigd ------------------------------------------------------------ # brig is not built here: its own release is fetched and repackaged into the tree. # "latest", for a local build, resolves to brig's newest release (prereleases @@ -1183,6 +1264,7 @@ info "laying out the tree" install -m 0755 "$DL/urunc" "$STAGE/bin/urunc" install -m 0755 "$DL/containerd-shim-urunc-v2" "$STAGE/bin/containerd-shim-urunc-v2" install -m 0755 "$DL/runc" "$STAGE/bin/runc" +[ "$HULL_INSTALLED" = true ] && install -m 0755 "$DL/hull" "$STAGE/bin/hull" tar -xzf "$DL/containerd.tar.gz" -C "$STAGE" bin/ if [ "$ROOTLESS" = true ]; then # nerdctl's tarball carries the two rootless launchers beside the binary, so @@ -1419,12 +1501,14 @@ if [ "$ROOTLESS" = true ]; then if [ "\$(id -u)" -eq 0 ]; then export CONTAINERD_ADDRESS="\${CONTAINERD_ADDRESS:-unix://$CONTAINERD_SOCK}" export NERDCTL_TOML="\${NERDCTL_TOML:-$ETC_DIR/nerdctl.toml}" + export NETCONFPATH="\${NETCONFPATH:-$ETC_DIR/cni/net.d}" else # The address is the one inside the rootlesskit namespace nerdctl re-enters, # not a path on the host: containerd-rootless.sh binds the user's runtime # directory onto /run/containerd in there. export CONTAINERD_ADDRESS="\${CONTAINERD_ADDRESS:-unix:///run/containerd/containerd.sock}" export NERDCTL_TOML="\${NERDCTL_TOML:-\${XDG_CONFIG_HOME:-\$HOME/.config}/brig/nerdctl.toml}" + export NETCONFPATH="\${NETCONFPATH:-\${XDG_CONFIG_HOME:-\$HOME/.config}/brig/cni/net.d}" fi CFG else @@ -1433,6 +1517,7 @@ else # stack, which only root can drive. export CONTAINERD_ADDRESS="\${CONTAINERD_ADDRESS:-unix://$CONTAINERD_SOCK}" export NERDCTL_TOML="\${NERDCTL_TOML:-$ETC_DIR/nerdctl.toml}" +export NETCONFPATH="\${NETCONFPATH:-$ETC_DIR/cni/net.d}" CFG fi cat >> "$STAGE/etc/brig-env.sh" <> "$STAGE/etc/brig-env.sh" <> "$STAGE/etc/brig-env.sh" <> "$STAGE/pins.env" fi +if [ "$HULL_PINNED" = false ]; then + echo "# WARNING: hull is the tip of $HULL_BRANCH at build time, not a pinned commit." >> "$STAGE/pins.env" +fi # Deterministic tar: sorted names, one fixed timestamp, root-owned, fixed # directory and file modes, no extended headers. Fetched components are -# byte-identical per pin; the urunc binary is byte-identical only if its build -# is reproducible (fixed commit, SOURCE_DATE_EPOCH, same toolchain image), so a -# bundle's reproducibility rests on that build too. +# byte-identical per pin; the urunc and hull binaries are byte-identical only if +# their builds are reproducible (fixed commit, SOURCE_DATE_EPOCH, same toolchain +# image), so a bundle's reproducibility rests on those builds too. info "packing" find "$STAGE" -type d -exec chmod 0755 {} + find "$STAGE" -type f ! -perm -u+x -exec chmod 0644 {} + diff --git a/tests/check-assets.sh b/tests/check-assets.sh index a3cdbd5..1004eb6 100644 --- a/tests/check-assets.sh +++ b/tests/check-assets.sh @@ -13,18 +13,18 @@ ok() { echo "ok - $*"; } T="$(mktemp -d)" trap 'rm -rf "$T"' EXIT -urunc=3c00b69ff9ac1b8bb260975cdc63d18a7043558b +urunc=5c6bc7060d4f6d33b0d4e8fd388f9f04cc88510b urunit=48a61bd480eb57871204523312127b06d0a05363 other=1111111111111111111111111111111111111111 -# assets : write the bundle.json hull-assets 0.1.11 ships, +# assets : write the bundle.json hull-assets 0.1.12 ships, # with the given sources object. assets() { cat > "$T/bundle.json" <&2; fail "$2 was refused, but not with '$1'"; } } -# 1. The bundle.json of hull-assets 0.1.11: urunc matches, no urunit recorded. +# 1. The bundle.json of hull-assets 0.1.12: urunc matches, no urunit recorded. assets "\"urunc\": { \"repo\": \"https://github.com/urunc-dev/urunc\", \"ref\": \"$urunc\" }" check || { cat "$T/err" >&2; fail "matching assets were refused"; } [ "$(cat "$T/out")" = "$urunc -" ] || fail "printed '$(cat "$T/out")', not the urunc ref and no urunit" diff --git a/tests/source-pins.sh b/tests/source-pins.sh index 912242d..cac7ae3 100755 --- a/tests/source-pins.sh +++ b/tests/source-pins.sh @@ -1,11 +1,11 @@ #!/bin/sh # # Run build-bundle.sh against a stub git, docker and curl, and check which urunc -# commit it asks for and which urunit commit it records. Nothing is fetched: the -# stub git records the ref it was asked to fetch, answers rev-parse with it and -# plants the urunit.pin the build reads from the urunc checkout; the stub docker -# fakes the urunc build; the stub curl fails the first download, which ends the -# run. +# and hull commits it asks for and which urunit commit it records. Nothing is +# fetched: the stub git records the ref it was asked to fetch, answers rev-parse +# with it and plants the urunit.pin the build reads from the urunc checkout; the +# stub docker fakes the urunc and hull builds; the stub curl fails the first +# download, which ends the run. # # Needs the tools build-bundle.sh checks for (curl, tar, sha256sum, awk, sed). @@ -22,6 +22,9 @@ command -v sha256sum >/dev/null 2>&1 || skip "build-bundle.sh needs sha256sum" urunc_pin="$(sed -n 's/^URUNC_REF_DEFAULT=\([0-9a-f]*\)$/\1/p' "$here/scripts/build-bundle.sh")" urunc_branch="$(sed -n 's/^URUNC_BRANCH_DEFAULT=\(.*\)$/\1/p' "$here/scripts/build-bundle.sh")" [ "${#urunc_pin}" -eq 40 ] || fail "no URUNC_REF_DEFAULT in build-bundle.sh" +hull_pin="$(sed -n 's/^HULL_REF_DEFAULT=\([0-9a-f]*\)$/\1/p' "$here/scripts/build-bundle.sh")" +hull_branch="$(sed -n 's/^HULL_BRANCH_DEFAULT=\(.*\)$/\1/p' "$here/scripts/build-bundle.sh")" +[ "${#hull_pin}" -eq 40 ] || fail "no HULL_REF_DEFAULT in build-bundle.sh" tip=1111111111111111111111111111111111111111 # The urunit commit the stub urunc checkout pins in its urunit.pin. The build # has no urunit pin of its own: it reads that file. @@ -32,9 +35,11 @@ trap 'rm -rf "$T"' EXIT mkdir -p "$T/stub" # git: log every call. fetch remembers what it was asked for, and rev-parse -# HEAD answers with it, or with $STUB_HEAD, or with $tip for a branch. A -# checkout of the urunc source plants urunit.pin, as the real commit carries -# one; STUB_NO_PIN=1 leaves it out. +# HEAD answers with it, or with $STUB_HEAD (with $STUB_HULL_HEAD in the hull +# checkout), or with $tip for a branch. A checkout of the urunc source plants +# urunit.pin, as the real commit carries one; STUB_NO_PIN=1 leaves it out. A +# checkout of the hull source plants internal/urunckeys/go.mod, requiring the +# pinned urunc or $STUB_HULL_URUNC; STUB_HULL_NO_KEYS=1 leaves it out. cat > "$T/stub/git" <> "$T/git.log" @@ -50,7 +55,8 @@ case "\$1" in fetch) for a in "\$@"; do last="\$a"; done; echo "\$last" > "$T/fetched" ;; rev-parse) f="\$(cat "$T/fetched")" - if [ -n "\${STUB_HEAD:-}" ]; then echo "\$STUB_HEAD" + if [ -n "\${STUB_HULL_HEAD:-}" ] && [ "\${dir%/hull-src}" != "\$dir" ]; then echo "\$STUB_HULL_HEAD" + elif [ -n "\${STUB_HEAD:-}" ]; then echo "\$STUB_HEAD" elif [ "\${#f}" -eq 40 ]; then echo "\$f" else echo $tip; fi ;; checkout) @@ -62,13 +68,20 @@ case "\$1" in "\${STUB_PIN_REPO:-https://github.com/NOFireAI/urunit.git}" $urunit_pin \\ > "\$dir/packaging/container-initrd/urunit.pin" fi ;; + */hull-src) + if [ -z "\${STUB_HULL_NO_KEYS:-}" ]; then + mkdir -p "\$dir/internal/urunckeys" + printf 'module github.com/brig-sh/hull/internal/urunckeys\n\ngo 1.26.8\n\nrequire github.com/urunc-dev/urunc v0.8.2-0.20261029205741-%s\n' \ + "\${STUB_HULL_URUNC:-$(printf '%.12s' "$urunc_pin")}" \ + > "\$dir/internal/urunckeys/go.mod" + fi ;; esac ;; esac exit 0 STUB -# docker: the urunc build writes the binaries the script copies out. Anything -# else is logged and fails: urunit and the initrd are no longer built. +# docker: the urunc and hull builds write the binaries the script copies out. +# Anything else is logged and fails: urunit and the initrd are no longer built. cat > "$T/stub/docker" <> "$T/docker.log" @@ -85,6 +98,15 @@ case "$*" in : > "$src/dist/urunc_static_amd64" : > "$src/dist/containerd-shim-urunc-v2_static_amd64" exit 0 ;; + *"make linux LINUX_ARCH=amd64"*) + prev="" + for a in "$@"; do + case "$prev" in -v) case "$a" in *:/app) src="${a%:/app}" ;; esac ;; esac + prev="$a" + done + mkdir -p "$src/dist" + : > "$src/dist/hull_linux_amd64" + exit 0 ;; esac exit 1 STUB @@ -93,7 +115,7 @@ printf '#!/bin/sh\nexit 22\n' > "$T/stub/curl" chmod 0755 "$T/stub"/* # build [VAR=value...]: run build-bundle.sh with those variables, output in -# $T/out.log. URUNC_* and URUNIT_* start unset. +# $T/out.log. URUNC_*, URUNIT_* and HULL_* start unset. build() { : > "$T/git.log" : > "$T/docker.log" @@ -101,31 +123,44 @@ build() { # Every run ends in a failure, by design: at the first download or at the # check under test. env -u URUNC_REF -u URUNC_BRANCH -u URUNIT_REF -u URUNIT_BRANCH -u URUNIT_REPO -u HVI_REF -u HVI_BRANCH \ + -u HULL_REF -u HULL_BRANCH \ PATH="$T/stub:$PATH" "$@" \ sh "$here/scripts/build-bundle.sh" --arch amd64 --version test --out "$T/dist" \ > "$T/out.log" 2>&1 || true } -# 1. Defaults: urunc is fetched at its pinned commit, by SHA. urunit is not -# fetched or built; the build reads the commit urunc's urunit.pin names. +# 1. Defaults: urunc is fetched at its pinned commit, by SHA, one commit deep. +# hull is fetched at its pin with its history and tags, since Go derives hull's +# version from the nearest v* tag. urunit is not fetched or built; the build +# reads the commit urunc's urunit.pin names. build -grep -qx "git -C .*/urunc-src fetch -q --depth 1 origin $urunc_pin" "$T/git.log" \ +grep -qx "git -C .*/urunc-src fetch -q --depth=1 origin $urunc_pin" "$T/git.log" \ || { cat "$T/git.log" "$T/out.log" >&2; fail "urunc was not fetched at its pin"; } grep -q "urunc: checked out urunc-dev/urunc@$urunc_pin (pinned" "$T/out.log" \ || { cat "$T/out.log" >&2; fail "the build log does not name the pinned urunc"; } grep -q "urunit: urunc $urunc_pin pins NOFireAI/urunit@$urunit_pin" "$T/out.log" \ || { cat "$T/out.log" >&2; fail "the build log does not name urunc's urunit pin"; } +grep -qx "git -C .*/hull-src fetch -q --tags origin $hull_pin" "$T/git.log" \ + || { cat "$T/git.log" "$T/out.log" >&2; fail "hull was not fetched at its pin"; } +grep -q "hull: checked out brig-sh/hull@$hull_pin (pinned" "$T/out.log" \ + || { cat "$T/out.log" >&2; fail "the build log does not name the pinned hull"; } +grep -q "hull: checks the urunc keys against urunc $(printf '%.12s' "$urunc_pin"), the bundle's" "$T/out.log" \ + || { cat "$T/out.log" >&2; fail "the build log does not say hull matches the bundle's urunc"; } grep -q "failed to download" "$T/out.log" \ - || { cat "$T/out.log" >&2; fail "the build did not get past the urunc build"; } + || { cat "$T/out.log" >&2; fail "the build did not get past the urunc and hull builds"; } if grep -q "urunit-src" "$T/git.log"; then fail "urunit was fetched"; fi grep -q "make static" "$T/docker.log" || fail "the urunc build did not run" -if grep -qv "make static" "$T/docker.log"; then - cat "$T/docker.log" >&2; fail "docker ran for something other than the urunc build" +grep -q "make linux LINUX_ARCH=amd64" "$T/docker.log" || fail "the hull build did not run" +# hull is pure Go: a static build with no telemetry endpoint. +grep "make linux" "$T/docker.log" | grep -q -- "-e CGO_ENABLED=0" || fail "hull was built with cgo" +if grep -q "TELEMETRY_ENDPOINT" "$T/docker.log"; then fail "hull was built with a telemetry endpoint"; fi +if grep -v -e "make static" -e "make linux" "$T/docker.log" | grep -q .; then + cat "$T/docker.log" >&2; fail "docker ran for something other than the urunc and hull builds" fi if grep -q -e "git clone" -e "WARNING" "$T/git.log" "$T/out.log"; then fail "a pinned build cloned a branch or warned" fi -ok "a default build fetches urunc at its pin and builds no urunit or initrd" +ok "a default build fetches urunc and hull at their pins and builds no urunit or initrd" # 1b. A urunc commit with no urunit.pin is refused, and so is a pin that names # no full commit. @@ -147,14 +182,43 @@ grep -q "checked out 2222222222222222222222222222222222222222, not the pinned $u || { cat "$T/out.log" >&2; fail "a wrong checkout was not refused"; } ok "a checkout other than the pin fails the build" +# 2b. The same for hull. +build STUB_HULL_HEAD=2222222222222222222222222222222222222222 +grep -q "brig-sh/hull: checked out 2222222222222222222222222222222222222222, not the pinned $hull_pin" "$T/out.log" \ + || { cat "$T/out.log" >&2; fail "a wrong hull checkout was not refused"; } +if grep -q "make linux" "$T/docker.log"; then fail "hull was built from a wrong checkout"; fi +ok "a hull checkout other than the pin fails the build" + +# 2c. A hull that checks the urunc keys against another urunc is refused before +# it is built, and so is one that does not say which urunc it checks against. +build STUB_HULL_URUNC=aaaaaaaaaaaa +grep -q "brig-sh/hull@$hull_pin checks the urunc keys against urunc aaaaaaaaaaaa, but this bundle carries urunc $urunc_pin" "$T/out.log" \ + || { cat "$T/out.log" >&2; fail "a hull written against another urunc was not refused"; } +if grep -q "make linux" "$T/docker.log"; then fail "hull was built against another urunc"; fi +build STUB_HULL_NO_KEYS=1 +grep -q "brig-sh/hull@$hull_pin has no internal/urunckeys/go.mod" "$T/out.log" \ + || { cat "$T/out.log" >&2; fail "a hull without internal/urunckeys/go.mod was not refused"; } +build STUB_HULL_URUNC=v0.8.2 +grep -q "not a pseudo-version that names a commit" "$T/out.log" \ + || { cat "$T/out.log" >&2; fail "a hull whose urunc version names no commit was not refused"; } +ok "a hull that checks the urunc keys against another urunc is refused" + # 3. An empty ref builds the branch tip, and says so. build URUNC_REF= -grep -qx "git -C .*/urunc-src fetch -q --depth 1 origin refs/heads/$urunc_branch" "$T/git.log" \ +grep -qx "git -C .*/urunc-src fetch -q --depth=1 origin refs/heads/$urunc_branch" "$T/git.log" \ || { cat "$T/git.log" >&2; fail "URUNC_REF= did not fetch the branch"; } grep -q "WARNING: urunc: built urunc-dev/urunc@$tip, the tip of $urunc_branch" "$T/out.log" \ || { cat "$T/out.log" >&2; fail "a tip build did not warn"; } ok "URUNC_REF= builds the tip of the branch, with a warning" +# 3b. The same for hull. +build HULL_REF= +grep -qx "git -C .*/hull-src fetch -q --tags origin refs/heads/$hull_branch" "$T/git.log" \ + || { cat "$T/git.log" >&2; fail "HULL_REF= did not fetch the branch"; } +grep -q "WARNING: hull: built brig-sh/hull@$tip, the tip of $hull_branch" "$T/out.log" \ + || { cat "$T/out.log" >&2; fail "a hull tip build did not warn"; } +ok "HULL_REF= builds the tip of hull's branch, with a warning" + # 4. A branch without a ref is refused before anything is fetched. build URUNC_BRANCH=feat/something-else grep -q "URUNC_BRANCH=feat/something-else is set but URUNC_REF is not" "$T/out.log" \ @@ -162,6 +226,12 @@ grep -q "URUNC_BRANCH=feat/something-else is set but URUNC_REF is not" "$T/out.l [ ! -s "$T/git.log" ] || fail "git ran for a refused build" ok "a branch without a ref is refused" +build HULL_BRANCH=feat/something-else +grep -q "HULL_BRANCH=feat/something-else is set but HULL_REF is not" "$T/out.log" \ + || { cat "$T/out.log" >&2; fail "a hull branch without a ref was not refused"; } +[ ! -s "$T/git.log" ] || fail "git ran for a refused build" +ok "a hull branch without a ref is refused" + # 4b. The urunit build knobs are gone, so setting one is refused, and so is # the hvi source build that no longer exists. for v in URUNIT_REF=4444444444444444444444444444444444444444 URUNIT_REF= \ @@ -186,3 +256,12 @@ grep -q "URUNC_REF='0818ff1' is not a commit" "$T/out.log" \ || { cat "$T/out.log" >&2; fail "a short SHA was not refused"; } [ ! -s "$T/git.log" ] || fail "git ran for a refused build" ok "a ref that is not a full SHA is refused" + +build HULL_REF=main +grep -q "HULL_REF='main' is not a commit" "$T/out.log" \ + || { cat "$T/out.log" >&2; fail "a branch name as a hull ref was not refused"; } +build HULL_REF=4bf76a6 +grep -q "HULL_REF='4bf76a6' is not a commit" "$T/out.log" \ + || { cat "$T/out.log" >&2; fail "a short SHA as a hull ref was not refused"; } +[ ! -s "$T/git.log" ] || fail "git ran for a refused build" +ok "a hull ref that is not a full SHA is refused" From c43e4a82e98ce18fb6d1f5a4ce95e965c1fdca55 Mon Sep 17 00:00:00 2001 From: Anastassios Nanos Date: Tue, 17 Nov 2026 10:50:16 +0200 Subject: [PATCH 2/2] chore(pins): Move hvi to 0.1.0-rc.3 hvi 0.1.0-rc.2 does not know --net-gateway on Linux: its KVM backend leaves the gateway socket unset, so a guest hull joins to a network gateway boots with no network. 0.1.0-rc.3, released from main at bde7c58, serves the gateway socket through the virtio-net device on Linux as on macOS. The release also carries the virtio-mmio transport rework and the device manager. HVI_SHA256_LINUX_AMD64 and _ARM64 are the release's SHA256SUMS entries for the two musl tarballs. fetch-hvi.sh fetched and verified both against the release's cosign bundle. Signed-off-by: Anastassios Nanos --- DESIGN.md | 2 +- README.md | 2 +- docs/variants.md | 2 +- scripts/build-bundle.sh | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 78db22d..6b8a131 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -33,7 +33,7 @@ now done and is what `install.sh` and `scripts/build-bundle.sh` produce. fetches nothing else. Because the config files carry the fixed layout, the paths above are not configurable at install time. - **Why urunc is built (at release).** Most components are upstream release - artifacts, hvi among them (`brig-sh/hvi-vmm` `v0.1.0-rc.2`, cosign-verified). + artifacts, hvi among them (`brig-sh/hvi-vmm` `v0.1.0-rc.3`, cosign-verified). urunc has no release that carries what brig needs, so the build compiles it from `urunc-dev/urunc` at commit `5c6bc70`, on `feat/linux-hvi-v050` (CGO static, so native per arch under qemu/binfmt). The source is pinned to a diff --git a/README.md b/README.md index 129eb08..6bf54b3 100644 --- a/README.md +++ b/README.md @@ -319,7 +319,7 @@ urunc and hull, which have none for Linux: | brig, brigd, brig-broker | `brig-sh/brig` release | fetched, verified against its signed `checksums.txt` | | urunc, containerd-shim-urunc-v2 | built from `urunc-dev/urunc` at commit `5c6bc70` (branch `feat/linux-hvi-v050`) | CGO-static, built in a Go container | | hull | built from `brig-sh/hull` at commit `4bf76a6` (branch `main`), which publishes no Linux release | static (`CGO_ENABLED=0`), built in a Go container, with no telemetry endpoint | -| hvi | `brig-sh/hvi-vmm` release `v0.1.0-rc.2` (commit `2ed8f61`); hull pins its own hvi for macOS (`hvi.pin`) and does not check this one | fetched, musl-static; its `SHA256SUMS` cosign-verified against hvi-vmm's release workflow, the tarball pinned by sha256 | +| hvi | `brig-sh/hvi-vmm` release `v0.1.0-rc.3` (commit `bde7c58`), the first whose Linux build takes `--net-gateway`; hull pins its own hvi for macOS (`hvi.pin`) and does not check this one | fetched, musl-static; its `SHA256SUMS` cosign-verified against hvi-vmm's release workflow, the tarball pinned by sha256 | | guest kernel, container-initrd | `ghcr.io/nofireai/hull-assets` `0.1.12` | fetched by digest once its cosign signature checks out; the initrd is urunit. urunc's `packaging/container-initrd/urunit.pin` names `48a61bd`; hull-assets `0.1.12` does not record its urunit, so the bundle records that commit as `urunit_expected`. The build refuses a hull-assets bundle built from another urunc | | monitors, virtiofsd | `urunc-dev/monitors-build` | fetched, pinned by sha256 | | containerd, runc, nerdctl, CNI | upstream releases | fetched, upstream checksums | diff --git a/docs/variants.md b/docs/variants.md index aadd6e7..0233074 100644 --- a/docs/variants.md +++ b/docs/variants.md @@ -166,7 +166,7 @@ refuses a stock binary, rather than printing a table of zeroes. from that urunc. urunc is pinned to a commit because a branch tip moves with every push; the README's build section says how to move it. 4. Settled: `build-bundle.sh` fetches hvi from a signed `brig-sh/hvi-vmm` - release (`v0.1.0-rc.2`). `scripts/fetch-hvi.sh` checks the + release (`v0.1.0-rc.3`). `scripts/fetch-hvi.sh` checks the cosign signature on its `SHA256SUMS`, the pinned sha256 of the tarball and the commit its manifest names. 5. Is `introspection` a variant at all, or `generic-boot` plus an opt-in flag? diff --git a/scripts/build-bundle.sh b/scripts/build-bundle.sh index 357c4bc..a28b710 100755 --- a/scripts/build-bundle.sh +++ b/scripts/build-bundle.sh @@ -150,10 +150,10 @@ HULL_GO_IMAGE="${HULL_GO_IMAGE:-golang:1.26.8}" # macOS (hvi.pin) and does not check this one. The tag, # its commit and the sha256 of each tarball describe one release, so a bump # changes all four together. scripts/fetch-hvi.sh checks them. -HVI_VERSION=0.1.0-rc.2 -HVI_COMMIT=2ed8f61dde8c20facd5f1a3668b170b07fb0eee1 -HVI_SHA256_LINUX_AMD64=e62358d9abcf2c8999227ef7ba16c25b57e131467eb4df916bffb68578b9ff25 -HVI_SHA256_LINUX_ARM64=3c11e3b1443fb9e39a652a0011ac74d548a7bd05674b6c4115ffbd5a0260e903 +HVI_VERSION=0.1.0-rc.3 +HVI_COMMIT=bde7c58edf3352e112c7c349448090623390aaec +HVI_SHA256_LINUX_AMD64=150959b450a9f37fbe53122b28f744d49a41bb05d2faae5edcd11e9fe4498b2a +HVI_SHA256_LINUX_ARM64=50370df6adb58e3aaaa2ac9c95fea72f239fd8069c2f2bdca40f684f44f7ed31 # A branch given without a ref would otherwise build the pinned commit and # ignore the branch, so ask which one was meant. if [ -n "${URUNC_BRANCH:-}" ] && [ "$URUNC_BRANCH" != "$URUNC_BRANCH_DEFAULT" ] && [ -z "${URUNC_REF+set}" ]; then