Skip to content

feat(vm): add the iso VmSource arm for unattended installs - #71

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/vm-iso-source
Aug 29, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/vm-iso-source

Conversation

@atrawog

@atrawog atrawog commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a sixth #VmSource arm, iso, so charly can install a distro that ships only an
installer medium
— no cloud image, no bootstrap tarball. Omarchy is the first such
target: it publishes omarchy-<ver>.iso and nothing else, so today it has no VM path at
all.

The arm boots the installer against an initially blank disk and lets the installer
partition and install. The split of responsibility is the one init:/service: already
established:

  • the vm entity owns the DATA — #VmInstaller: username, password ⊻
    password_hash, disk, hostname, timezone, locale, keyboard, encrypt,
    ssh_authorized_key[], defer_provisioning, plus a typed-open answer: map for
    per-distro extras;
  • the distro owns the FORMAT — #DistroInstaller: the answers volume's volume_id
    and fs, the file[] list of Go templates with a when: guard, an optional
    boot_arg, and done: poweroff | marker.

That split is deliberate. archinstall JSON, kickstart, preseed, Subiquity autoinstall and
AutoYaST are five real formats, each keyed by distro and by nothing else — so nothing
infers a format from a URL, an ISO name or a base_user. #InstallerSeedContext is what
those templates render against; the plaintext password never reaches it (the caller
crypt()s first), so no plaintext lands on the answers volume, in a log, or in a temp file.

distro is CUE-required on this arm, following bootstrap rather than cloud_image:
the answer-file format lives on the distro, so an absent value is a hard nil at render
time with no plausible default to trade against.

Purely additive — a new arm in a closed disjunction and new optional defs invalidate no
existing config, so no migration entry and no #SchemaVersion bump. Nothing consumes
the arm yet; plugin-substrate's validateSourceDistro and plugin-vm's build path
follow in their own repos, which is the contract-first landing order this repo already
uses.

How tested

The arm was verified working before the schema was written. The real
omarchy-4.0.1.iso (sha256 verified) was booted under QEMU/OVMF with a cidata answers
volume built exactly as #DistroInstaller describes. It installed fully unattended,
rebooted itself, and came up as Omarchy 7.1.9-arch1-2:

$ genisoimage -output cidata.iso -volid cidata -joliet -rock cidata/
$ qemu-system-x86_64 -enable-kvm -m 8192 -smp 4 -machine q35 \
    -drive if=pflash,...OVMF_CODE.4m.fd -drive if=pflash,file=OVMF_VARS.fd \
    -drive file=disk.qcow2,if=virtio -drive file=omarchy-4.0.1.iso,media=cdrom \
    -drive file=cidata.iso,media=cdrom -boot order=cd ...

$ ssh -i spike_key [email protected] -p 2299 'id; uname -r'
uid=1000(user) gid=1000(user) groups=1000(user),992(input),998(wheel)
7.1.9-arch1-2

Every field the schema models was consumed by the real installer: SSH worked from
ssh_authorized_key alone (proving the seeded authorized_keys enabled sshd and opened
the firewall), git config user.name/user.email returned the values from
full_name/email, hostname and sudo came from the answers, and the resulting
layout was /dev/vda2[/@] btrfs subvol=/@ with the ESP at /boot — matching
#DistroInstaller's done: poweroff flow.

Schema tests — schema/vm_iso_source_test.go, corpus and teeth:

$ go test -count=1 ./schema/ -run 'Iso|Installer|VmSource' -v
--- PASS: TestVmSourceAcceptsTheIsoArm
--- PASS: TestVmSourceAcceptsDeferredProvisioning
--- PASS: TestVmSourceIsoRejectsCrossBranchFields
--- PASS: TestVmSourceIsoRequiresDistroLikeBootstrap
--- PASS: TestVmSourceIsoRejectsUnknownDistro
--- PASS: TestDistroInstallerAcceptsTheOmarchyShape
--- PASS: TestDistroInstallerRejectsAMalformedVolumeID
ok  	github.com/opencharly/spec/schema	0.146s

The corpus case is the exact source literal of the VM installed above, not a
hypothetical. The teeth reject rootfs, root_size, base_user, builder,
builder_image and box on this arm (each belongs to another source kind and would be
silently ignored by the iso build path), an unknown distro, and a malformed
volume_id.

TestVmSourceIsoRequiresDistroLikeBootstrap is written as parity with the bootstrap
arm
rather than against a bare validation mode: a required-but-absent field is
incomplete, not conflicting, so it surfaces only under a concreteness check. The test
asserts bootstrap rejects it too, and fails loudly if that premise ever goes stale.

Full repo gate on the final tree:

$ task cue:gen
cue:gen: regenerated spec/{cue_types_gen.go,vocab_gen.go,version_gen.go}

$ gofmt -l .          # no output
$ go build ./...      # rc=0
$ go vet ./...        # rc=0
$ golangci-lint run ./...
0 issues.

$ go test -count=1 ./...   # rc=0
ok  	github.com/opencharly/spec/climodel	0.025s
ok  	github.com/opencharly/spec/container	2.593s
ok  	github.com/opencharly/spec/exec	7.865s
ok  	github.com/opencharly/spec/exitcode	0.003s
ok  	github.com/opencharly/spec/fleet	0.005s
ok  	github.com/opencharly/spec/hostenv	0.006s
ok  	github.com/opencharly/spec/internal/wiregen	0.021s
ok  	github.com/opencharly/spec/lock	0.005s
ok  	github.com/opencharly/spec/matchers	0.005s
ok  	github.com/opencharly/spec/merge	0.005s
ok  	github.com/opencharly/spec/ops	0.005s
ok  	github.com/opencharly/spec/phase	0.003s
ok  	github.com/opencharly/spec/poll	0.229s
ok  	github.com/opencharly/spec/proc	0.605s
ok  	github.com/opencharly/spec/refs	6.825s
ok  	github.com/opencharly/spec/schema	0.418s
ok  	github.com/opencharly/spec/spec	0.305s
ok  	github.com/opencharly/spec/transport	0.187s

-count=1 defeats the build cache, so every package genuinely re-ran; all 18
test-bearing packages are shown with real timings and none is elided. The remaining 14
packages report [no test files]. schema 0.418s carries the new tests.

Rulebook compliance

  • R3 — no duplication. The answer-file format is declared once, on the distro. No
    second copy in Go, and nothing infers it from a URL or an ISO name — the same rule
    distro_vocab.cue's header states for every distro trait.
  • R4 — no workarounds. done: poweroff | marker is a process-exit or guest-agent
    poll, never a sleep. Generated Go comes from task cue:gen, never hand-edited;
    the one hand-written file (spec/union_types.go) is the documented exception for the
    flat discriminated struct, and it is updated in the same commit as the CUE.
  • R5 — no legacy left behind. Purely additive; nothing is deprecated.
  • R6 — git safety. Feature branch, PR-only, no force-push, no direct push to main,
    no hook bypass.
  • R10 — proof from the final tree. The gate above ran on the committed tree, and the
    behaviour it encodes was proven on a real unattended install before the schema existed.

Change classification

  • Change class: additive schema arm + two new defs + their generated Go, plus the
    two hand-written VmSource fields the @go(-) union requires. No authored wire key
    changes, so no migration entry and no #SchemaVersion bump.
  • Verification gate: task cue:gen + gofmt + go build + go vet +
    go test -count=1 ./... + golangci-lint run ./..., all green on the final tree, plus
    a real end-to-end unattended install of the medium this arm models.
  • Attribution tier: fully tested and validated — the full repo gate passes on the
    final tree, the new schema paths are exercised by seven corpus-and-teeth tests, and the
    install flow the arm describes was executed live.

Assisted-by: Claude Code claude-opus-5[1m] (fully tested and validated)

Some distros ship ONLY an installer medium — no cloud image, no bootstrap
tarball. Omarchy is the first charly targets: it publishes omarchy-<ver>.iso
and nothing else. The five existing #VmSource arms cannot express that, so
such a distro has no VM path at all.

The `iso` arm boots the installer medium against an initially blank disk and
lets the installer partition and install. The unattended ANSWERS live on the
vm entity (#VmInstaller: username, disk, hostname, timezone, ssh keys, …);
the answer-file FORMAT lives on the distro (#DistroInstaller), exactly as
`init:` renders `service:`. archinstall JSON, kickstart, preseed, Subiquity
autoinstall and AutoYaST are five real formats, each keyed by distro and by
nothing else — so nothing infers a format from a URL or an ISO name.

distro is CUE-required on this arm, following `bootstrap` rather than
`cloud_image`: the answer-file format lives on the distro, so an absent value
is a hard nil at render time with no plausible default to fall back to.

Verified end to end before the schema was written: the real omarchy-4.0.1.iso
installed unattended under QEMU/OVMF from a rendered cidata seed, rebooted
itself, and was reachable over SSH using only the seeded key.

Claude-Session: https://claude.ai/code/session_01YKF2VLqeHHbrBDz8XftaD3
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: fabb988769f2 (branch: feat/vm-iso-source-arm)

Security screen: PASS — no embedded directives, no scope mismatch (5 files all accounted for in the body), no secrets/exfiltration, no weakened guardrails, no supply-chain changes.

Checklist: All applicable rules PASS or NA.

  • Change class: additive schema arm + two new CUE defs + generated Go + hand-written union_types.go fields + tests. Runtime gate (cue:gen, gofmt, go build, go vet, golangci-lint, go test -count=1 ./...) supplied with coherent, internally-consistent pasted output; -count=1 defeats cache; 18 test-bearing packages with real timings; zero warnings.
  • A1/A3: Body accounts for every file; evidence supplied for each gate; Assisted-by: line present in exact form; "fully tested and validated" justified — new schema paths executed via seven corpus-and-teeth tests against the fresh rebuild, and the install flow was proven live (honestly disclosed as manual qemu, pre-schema).
  • SDD: CUE-source mandate satisfied — schema/*.cue changes paired with cue_types_gen.go in the same commit; the @go(-) on the vm arm is the documented union_types.go flat-discriminated-struct exception, explicitly stated.
  • B16 placement: CORRECT — wire shapes live in the spec layer (CUE-first); the distro owns the format (#DistroInstaller on distro.cue), the vm entity owns the data (#VmInstaller); capability (render/build) correctly deferred to plugin-vm (a candy). No alias files, no new core imports, no *Legacy* identifiers.
  • R2: "follow in their own repos" is the contract-first landing order this repo already uses, naming the exact consumer repos — not a surfaced-issue deferral.
  • R10 coverage: teeth reject cross-branch fields, unknown distro, malformed volume_id; corpus case is the real install literal; parity test against bootstrap arm. Coverage proves the new behavior.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant