mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 21:36:40 -10:00
Each VM is a container from an image devvm builds by running its scripts in a container and committing it. A container is not a VM: on Linux it shares the host's kernel, on macOS Docker Desktop's one VM; docker.md says so first. - internal/backend/docker: build-image (docker commit; base from Ubuntu's image by digest, prepared by the container scripts smolvm shares, now in assets/container), from (any image Docker has or pulls), clone, project-mount and agent-folders (bind mounts), tools-share (tool images unpacked into a volume by a network-less container, linked by guest/tools.sh; ToolFormat dir-<unpack.sh>), cpus and memory (docker update). Build confinement native only on a rootful engine of this Linux machine; Docker Desktop and other engines build nothing yet. - Containers run --init and a sleep; services.sh after each start, without Docker's daemon. Mounts and network are hashed into a label; a start that finds them changed commits the container and makes it again under the same name (flattened past 100 layers), its home a per-VM volume. - The VM's user has the host's uid, and on Linux its gid. A --clone VM's clone gets a volume (VMSpec.CloneAt). - Disk none: DiskUser reports what a VM holds (devvm size's disk_used), warned past base's disk by launches and ls; a default disk size is left out of a new VM on such a backend, said. - Everything labelled devvm.data=<data folder>; only labelled resources are touched; names Docker shares between users carry its hash. - Problems: docker on PATH, a reachable engine (or the docker group fix), 29.1+, Linux containers, this machine's arch; Report names the engine and Docker Desktop's file sharing, which CreateVM checks. - ssh, ports, ports-all, agent forwarding and toggling, egress-proxy, disk and the new docker-layer feature are none: refused in one line. Builds ask for build features only when they build, so a built image works where it couldn't be built. - testdata/stubs/docker: a stateful engine; docker.txtar; unit tests; tests/e2e.sh --backend docker on a Linux engine in a Lima VM e2e keeps (~/.lt-e2e-go-docker) and on Docker Desktop, with images copied from the Linux run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
77 lines
2.3 KiB
Plaintext
77 lines
2.3 KiB
Plaintext
# setup: the default backend and base's features (both asked in a
|
|
# terminal, which Go tests cover; without one, the backend isn't asked and
|
|
# the features are kept, or every one until they're chosen; --backend and
|
|
# --features without asking). A new choice of features says base
|
|
# rebuilds, and once images are built that devvm gc deletes the old ones.
|
|
env DEVVM_MESSAGES=names
|
|
env CHOSEN=$XDG_CONFIG_HOME/devvm/base-features
|
|
|
|
# Kept: none chosen; no backend asked.
|
|
exec devvm setup
|
|
stdout '^==> base_features_none$'
|
|
! stdout base_will_rebuild
|
|
! stdout default_backend
|
|
! exists $XDG_CONFIG_HOME/devvm/backend
|
|
! stderr .
|
|
! stub_calls
|
|
|
|
# Unchosen: every feature.
|
|
rm $CHOSEN
|
|
exec devvm setup
|
|
stdout '^==> base_features features=cli-tools fzf omb$'
|
|
! stdout base_will_rebuild
|
|
|
|
# --features, in the order features run; nothing built yet.
|
|
exec devvm setup --features omb,fzf
|
|
stdout '^==> base_features features=fzf omb$'
|
|
stdout '^==> base_will_rebuild$'
|
|
! stdout gc_old_hint
|
|
! stdout default_backend
|
|
cmp $CHOSEN fzf-omb
|
|
exec devvm setup --features fzf,omb
|
|
! stdout base_will_rebuild
|
|
|
|
# Built: a new choice rebuilds base, and gc deletes the old one.
|
|
exec devvm build base
|
|
exec devvm setup --features ''
|
|
stdout '^==> base_features_none$'
|
|
stdout '^==> base_will_rebuild$'
|
|
stdout '^gc_old_hint$'
|
|
exec devvm build base
|
|
stdout '^==> building_image image=base key='
|
|
exec devvm gc
|
|
stdout '^gc_image image=base key='
|
|
|
|
# A name that isn't a feature changes nothing.
|
|
! exec devvm setup --features fzf,nope
|
|
stderr '^devvm: no_feature feature=nope features=cli-tools fzf omb$'
|
|
! stdout base_features
|
|
exec devvm setup
|
|
stdout '^==> base_features_none$'
|
|
|
|
# The default backend: only it, unless --features is given too.
|
|
exec devvm setup --backend lima
|
|
stdout '^==> default_backend backend=lima$'
|
|
! stdout base_features
|
|
cmp $XDG_CONFIG_HOME/devvm/backend lima.txt
|
|
exec devvm setup --backend lima --features fzf
|
|
stdout '^==> default_backend backend=lima$'
|
|
stdout '^==> base_features features=fzf$'
|
|
! exec devvm setup --backend nope
|
|
stderr '^devvm: backend_unknown backends=docker, lima, smolvm name=nope$'
|
|
cmp $XDG_CONFIG_HOME/devvm/backend lima.txt
|
|
|
|
# An unreadable choice stays for you to fix.
|
|
cp bad $CHOSEN
|
|
! exec devvm setup
|
|
stderr '^devvm: setup_failed reason=.*base-features'
|
|
cmp $CHOSEN bad
|
|
|
|
-- fzf-omb --
|
|
fzf
|
|
omb
|
|
-- lima.txt --
|
|
lima
|
|
-- bad --
|
|
Not_A_Feature
|