Skip to content

Commit 12394da

Browse files
Kabuki94claude
andcommitted
feat(build): just all / just verify-images / just publish meta-targets
Closes the manifesto requirement that the build pipeline produce ALL MiOS deployment formats from one command: "starts FULL build pipeline including all the different image types and formats for ALL MiOS deployment types -- Hyper-V, WSL2/g, QEMU, OCI images, Live-CD/USB, USB installer, RAW, etc" Three new recipes wire what was already there into a single chain: 1. `just all` — end-to-end build of every deployable artifact: OCI image -> localhost/mios:latest RAW disk -> output/disk.raw ISO (Live-CD / USB installer)-> output/install.iso QCOW2 (QEMU) -> output/qcow2/disk.qcow2 VHD/VHDX (Hyper-V) -> output/vhd*/disk.{vhd,vhdx} WSL2 tarball (WSL2/g) -> output/wsl2/disk.wsl2 Build order is deliberate: OCI must exist before any BIB recipe runs. Prerequisites: MIOS_USER_PASSWORD_HASH and MIOS_SSH_PUBKEY env vars for the qcow2 + vhdx recipes that bake the operator's identity. Run-time: ~25-40 min on the dev host depending on cache state. 2. `just verify-images` — magic-byte + size sanity check on every artifact in output/. Fast (no actual boot). Catches truncated / missing artifacts BEFORE the operator wastes time trying to import a half-baked vhdx into Hyper-V. Exits non-zero if any check fails. 3. `just publish` — pushes the OCI image to ghcr.io and prints guidance for Forgejo Releases / GitHub Releases upload of the disk images. Composes the previous two so a single `just publish` call gates on `verify-images` passing first. Existing single-format recipes (just raw / iso / qcow2 / vhdx / wsl2) are unchanged. The meta-target just chains them. This closes manifesto bite B from the post-C:\/M:\-saga session plan. Combined with the overlay-builder.sh work in 9b643dc, MiOS-DEV now hosts the same Quadlets a deployed MiOS host runs AND can drive a single-command produces-every-format build pipeline. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 9b643dc commit 12394da

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

Justfile

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,79 @@ wsl2: build
222222
{{BIB}} build --type wsl2 {{LOCAL}}
223223
@echo "[OK] WSL2 image in output/ -- import with: wsl --import 'MiOS' ./mios output/disk.wsl2"
224224

225+
# Build EVERY MiOS deployable artifact in one shot.
226+
# Manifesto: "starts FULL build pipeline including all the different image
227+
# types and formats for ALL MiOS deployment types -- Hyper-V, WSL2/g, QEMU,
228+
# OCI images, Live-CD/USB, USB installer, RAW, etc"
229+
#
230+
# Order is deliberate -- the OCI image must exist BEFORE any BIB recipe
231+
# runs (BIB reads from /var/lib/containers/storage). After the build:
232+
# - localhost/mios:latest (OCI image)
233+
# - output/disk.raw (RAW disk)
234+
# - output/install.iso (Live-CD / USB installer)
235+
# - output/qcow2/disk.qcow2 (QEMU)
236+
# - output/{vhd|vhdx}/disk.{vhd,vhdx} (Hyper-V)
237+
# - output/wsl2/disk.wsl2 (tar.gz) (WSL2/g)
238+
#
239+
# Prerequisites:
240+
# MIOS_USER_PASSWORD_HASH (qcow2 + vhdx need this -- the operator's
241+
# login-shell SHA-512 hash, generated via
242+
# openssl passwd -6 'pw').
243+
# MIOS_SSH_PUBKEY (qcow2 + vhdx -- ed25519 public key for
244+
# sudo-less remote management).
245+
#
246+
# Use `just verify-images` after to sanity-check every artifact landed.
247+
all: build raw iso qcow2 vhdx wsl2
248+
@echo ""
249+
@echo "[OK] All MiOS deployable artifacts built. Output:"
250+
@ls -lah output/ 2>/dev/null || true
251+
@echo ""
252+
@echo "[NEXT] Run 'just verify-images' to confirm artifact integrity."
253+
254+
# Smoke-test every artifact in output/ -- non-zero size, recognizable
255+
# magic bytes, sane disk-image geometry. Fast (no actual boot).
256+
verify-images:
257+
@echo "[verify] Walking output/ for MiOS deployable artifacts..."
258+
@ok=0; fail=0; \
259+
for f in output/*.raw output/*.iso output/qcow2/*.qcow2 output/vhd*/*.vhd* output/wsl2/*.wsl2 output/wsl2/*.tar.gz; do \
260+
[ -f "$$f" ] || continue; \
261+
sz=$$(stat -c%s "$$f" 2>/dev/null || stat -f%z "$$f"); \
262+
if [ "$${sz:-0}" -lt 1048576 ]; then \
263+
echo " [FAIL] $$f -- under 1 MiB ($$sz bytes); likely truncated"; \
264+
fail=$$((fail+1)); continue; \
265+
fi; \
266+
case "$$f" in \
267+
*.raw) hdr=$$(head -c8 "$$f" | xxd -p 2>/dev/null) ;; \
268+
*.iso) hdr=$$(dd if="$$f" bs=1 skip=32769 count=5 2>/dev/null | tr -d '\0') ;; \
269+
*.qcow2) hdr=$$(head -c4 "$$f" | xxd -p 2>/dev/null) ;; \
270+
*.vhd|*.vhdx) hdr=$$(head -c8 "$$f" | xxd -p 2>/dev/null) ;; \
271+
*.wsl2|*.tar.gz) hdr=$$(head -c2 "$$f" | xxd -p 2>/dev/null) ;; \
272+
*) hdr="?" ;; \
273+
esac; \
274+
printf " [OK] %-50s %15d bytes magic=%s\n" "$$f" "$$sz" "$$hdr"; \
275+
ok=$$((ok+1)); \
276+
done; \
277+
echo ""; \
278+
echo "[verify] $$ok artifact(s) passed, $$fail failed"; \
279+
[ "$$fail" -eq 0 ]
280+
281+
# Push EVERY artifact to its respective destination:
282+
# - OCI image -> ghcr.io/mios-dev/mios:latest (cloud + ghcr)
283+
# - Disk images -> Forgejo Releases on the local self-hosted forge
284+
# (operator pulls them locally for installer/USB
285+
# use without round-tripping through the cloud)
286+
# Run AFTER `just all` and `just verify-images` succeed.
287+
publish: all verify-images
288+
@echo "[publish] Pushing OCI image..."
289+
podman push {{LOCAL}} {{IMAGE_NAME}}:{{VERSION}}
290+
podman push {{LOCAL}} {{IMAGE_NAME}}:latest
291+
@echo "[publish] OCI image pushed: {{IMAGE_NAME}}:{{VERSION}}"
292+
@echo ""
293+
@echo "[publish] Disk images stay in output/ -- Forgejo Releases / GitHub Releases"
294+
@echo "[publish] upload is operator-driven via 'gh release create' or the"
295+
@echo "[publish] Forgejo web UI (Releases tab on the local forge)."
296+
@ls -1 output/ 2>/dev/null
297+
225298

226299
# Log artifacts to MiOS-bootstrap repository (Linux FS native)
227300
log-bootstrap:

0 commit comments

Comments
 (0)