Manage image artifacts and show VM create progress
Stop relying on ad hoc rootfs handling by adding image promotion, managed work-seed fingerprint metadata, and lazy self-healing for older managed images after the first create. Rebuild guest images with baked SSH access, a guest NIC bootstrap, and default opencode services, and add the staged Void kernel/initramfs/modules workflow so void-exp uses a matching Void boot stack. Replace the opaque blocking vm.create RPC with a begin/status flow that prints live stages in the CLI while still waiting for vsock health and opencode on guest port 4096. Validate with GOCACHE=/tmp/banger-gocache go test ./... and live void-exp create/delete smoke runs.
This commit is contained in:
parent
9f09b0d25c
commit
30f0c0b54a
37 changed files with 2334 additions and 99 deletions
90
register-void-image.sh
Executable file
90
register-void-image.sh
Executable file
|
|
@ -0,0 +1,90 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
log() {
|
||||
printf '[register-void-image] %s\n' "$*" >&2
|
||||
}
|
||||
|
||||
find_latest_matching() {
|
||||
local dir="$1"
|
||||
local pattern="$2"
|
||||
if [[ ! -d "$dir" ]]; then
|
||||
return 1
|
||||
fi
|
||||
find "$dir" -maxdepth 1 -type f -name "$pattern" | sort | tail -n 1
|
||||
}
|
||||
|
||||
find_latest_module_dir() {
|
||||
local root="$1"
|
||||
if [[ ! -d "$root" ]]; then
|
||||
return 1
|
||||
fi
|
||||
find "$root" -mindepth 1 -maxdepth 1 -type d | sort | tail -n 1
|
||||
}
|
||||
|
||||
resolve_banger_bin() {
|
||||
if [[ -n "${BANGER_BIN:-}" ]]; then
|
||||
printf '%s\n' "$BANGER_BIN"
|
||||
return
|
||||
fi
|
||||
if [[ -x "$SCRIPT_DIR/banger" ]]; then
|
||||
printf '%s\n' "$SCRIPT_DIR/banger"
|
||||
return
|
||||
fi
|
||||
if command -v banger >/dev/null 2>&1; then
|
||||
command -v banger
|
||||
return
|
||||
fi
|
||||
log "banger binary not found; build it first with 'make build' or set BANGER_BIN"
|
||||
exit 1
|
||||
}
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
DEFAULT_RUNTIME_DIR="$SCRIPT_DIR"
|
||||
if [[ -d "$SCRIPT_DIR/runtime" ]]; then
|
||||
DEFAULT_RUNTIME_DIR="$SCRIPT_DIR/runtime"
|
||||
fi
|
||||
|
||||
RUNTIME_DIR="${BANGER_RUNTIME_DIR:-$DEFAULT_RUNTIME_DIR}"
|
||||
IMAGE_NAME="${VOID_IMAGE_NAME:-void-exp}"
|
||||
BANGER_BIN="$(resolve_banger_bin)"
|
||||
ROOTFS="$RUNTIME_DIR/rootfs-void.ext4"
|
||||
WORK_SEED="$RUNTIME_DIR/rootfs-void.work-seed.ext4"
|
||||
PACKAGES="$SCRIPT_DIR/packages.void"
|
||||
|
||||
if [[ ! -f "$ROOTFS" ]]; then
|
||||
log "missing Void rootfs: $ROOTFS"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "$WORK_SEED" ]]; then
|
||||
log "missing Void work-seed: $WORK_SEED"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
args=(
|
||||
image register
|
||||
--name "$IMAGE_NAME"
|
||||
--rootfs "$ROOTFS"
|
||||
--work-seed "$WORK_SEED"
|
||||
--packages "$PACKAGES"
|
||||
)
|
||||
|
||||
if [[ ! -d "$RUNTIME_DIR/void-kernel" ]]; then
|
||||
log "missing staged Void kernel artifacts: $RUNTIME_DIR/void-kernel"
|
||||
log "run 'make void-kernel' before registering $IMAGE_NAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
kernel="$(find_latest_matching "$RUNTIME_DIR/void-kernel/boot" 'vmlinux-*' || true)"
|
||||
initrd="$(find_latest_matching "$RUNTIME_DIR/void-kernel/boot" 'initramfs-*' || true)"
|
||||
modules="$(find_latest_module_dir "$RUNTIME_DIR/void-kernel/lib/modules" || true)"
|
||||
|
||||
if [[ -z "$kernel" || -z "$initrd" || -z "$modules" ]]; then
|
||||
log "staged Void kernel is incomplete; expected vmlinux, initramfs, and modules under $RUNTIME_DIR/void-kernel"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "using staged Void kernel artifacts from $RUNTIME_DIR/void-kernel"
|
||||
args+=(--kernel "$kernel" --initrd "$initrd" --modules "$modules")
|
||||
|
||||
"$BANGER_BIN" "${args[@]}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue