mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 21:36:40 -10:00
devvm ssh is devvm host. devvm tools shows this folder's VM's shared tools (TOOL VERSION NEWER BUILT, from the lock as it is, never online); devvm tools add/rm TOOL... add and take out shared tools, each a word of its own (joined with + refused: tools_joined; add takes only shared tools: unknown_tool), and devvm tools update moves the VM to the newest. devvm IMAGE on a VM that exists adds nothing and asks nothing: it fails with vm_lacks_tools, naming the devvm tools add command, or vm_lacks_layer, as only a new VM gets a layer. devvm export is devvm history export [FILE]; devvm history lists the exports in the exports folder (FILE VM FOLDER DATE SIZE), the folder from a <export>.folder file written beside devvm's own exports and deleted with them. gc --exports is gc --history, retention's exports.age/count are history.age/count, and devvm space's row is history. The in-place layer machinery goes: Launch.addLayers and runLayers, dockerLayers' inPlace/set/unset, backend.DockerLayerVM.SetDockerLayer and the Docker backend's SetDockerLayer, with the add_in_place, restart_for_mounts, no_terminal_confirm, keeping, adding and add_layer_failed messages. vm.Tools (tools.go) holds Add, Remove, Update and List; tools.VMs.Show lists a VM's tools; tools.Remove takes names as a list; VMs.Update compares a VM's files as a set. New messages: vm_lacks_tools, vm_lacks_layer, has_tools, tools_joined, history_failed, tools_failed; renamed: unknown_tool, gc_history, gc_history_export, deleted_history, gc_older_than_needs_history. Command files: host.go, tools.go, history.go, refreshtools.go (_refresh-tools); ssh.go, remove.go, update.go, export.go and gc_exports.go gone. Tests: TestImageLacks, TestToolsAdd, TestShow, TestCompleteToolNames; history.txtar, gc_history.txtar, host_code.txtar and the e2e tools, docker layer and host checks updated. Docs, the CLI reference, AGENTS.md and the e2e header follow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
99 lines
3.6 KiB
Plaintext
99 lines
3.6 KiB
Plaintext
# devvm host and devvm code: the folder's VM launched as devvm does without
|
|
# its shell (checked, started, self-checked, set up, in devvm's ssh
|
|
# config), then its host name shown, or its folder opened in VS Code (a
|
|
# stub code) with the SSH agent devvm started with. The Include line is
|
|
# offered for the sandbox's own ~/.ssh/config only.
|
|
env DEVVM_MESSAGES=names
|
|
env VMS=$XDG_DATA_HOME/devvm/vms
|
|
env CFG=$XDG_CONFIG_HOME/devvm
|
|
|
|
# No VM.
|
|
mkdir $WORK/web
|
|
cd $WORK/web
|
|
! exec devvm host
|
|
stderr '^devvm: no_vm dir=\S*/web$'
|
|
! exec devvm code
|
|
stderr '^devvm: no_vm dir=\S*/web$'
|
|
! exec devvm host now
|
|
stderr '^devvm: usage_error '
|
|
! exec devvm code .
|
|
stderr '^devvm: usage_error '
|
|
|
|
# A stopped VM: started and set up, no shell. Without a terminal, the
|
|
# Include line is shown, not added.
|
|
exec devvm --no-network-policy --no-git-protect base
|
|
exec sh -c 'limactl stop "$(basename "$VMS"/devvm-web-*)"'
|
|
exec sh -c ': > "$STUB_LOG"'
|
|
exec devvm host
|
|
stdout '^==> starting vm=devvm-web-[0-9a-f]{14}$'
|
|
stdout '^ssh_include_needed line=Include /\S*/config/devvm/ssh_config$'
|
|
stderr '^devvm: ssh_include_yourself$'
|
|
stdout '^ssh_host_info dir=/\S*/web host=devvm-web$'
|
|
stub_calls
|
|
stdout '^limactl start --tty=false devvm-web-[0-9a-f]{14}$'
|
|
stdout 'tar -xf'
|
|
! stdout 'limactl shell --workdir /\S*/web devvm-web'
|
|
exec sh -c 'cat "$CFG/ssh_config"'
|
|
stdout '^Host devvm-web devvm-web-[0-9a-f]{14}$'
|
|
! exists $HOME/.ssh
|
|
|
|
# With the line there: nothing asked. A size its state asks for waits for
|
|
# the running VM's next start, as on a launch.
|
|
exec sh -c 'mkdir -p "$HOME/.ssh" && echo "Include $CFG/ssh_config" > "$HOME/.ssh/config"'
|
|
exec sh -c 'f=$(ls "$VMS"/devvm-web-*); echo cpus=6 >> "$f"'
|
|
exec sh -c ': > "$STUB_LOG"'
|
|
exec devvm host
|
|
! stdout 'starting|ssh_include'
|
|
stderr '^devvm: size_next_start vm=devvm-web-[0-9a-f]{14}$'
|
|
stdout '^ssh_host_info dir=/\S*/web host=devvm-web$'
|
|
stub_calls
|
|
! stdout 'limactl (start|edit)'
|
|
|
|
# devvm code: the folder in VS Code over Remote-SSH, with the SSH agent
|
|
# devvm started with, though this VM's own connections carry none.
|
|
env SSH_AUTH_SOCK=$WORK/user-agent.sock
|
|
exec sh -c ': > "$STUB_LOG"'
|
|
exec devvm code
|
|
stub_calls
|
|
stdout '^code --remote ssh-remote\+devvm-web /\S*/web$'
|
|
exec sh -c 'cat "$STUB_DIR/code-agent"'
|
|
stdout '^\S*/user-agent\.sock$'
|
|
env SSH_AUTH_SOCK=
|
|
|
|
# Two folders named web: the VM by its full name.
|
|
mkdir $WORK/other/web
|
|
cd $WORK/other/web
|
|
exec devvm --no-network-policy --no-git-protect base
|
|
exec sh -c ': > "$STUB_LOG"'
|
|
exec devvm code
|
|
stub_calls
|
|
stdout '^code --remote ssh-remote\+devvm-web-[0-9a-f]{14} /\S*/other/web$'
|
|
|
|
# No code command on PATH: said, with the host to connect to.
|
|
exec sh -c 'mkdir "$WORK/nocode" && for f in "$(dirname "$DEVVM_HOST_MISE")"/*; do [ "${f##*/}" = code ] || ln -s "$f" "$WORK/nocode/"; done'
|
|
env SAVED_PATH=$PATH
|
|
env PATH=$DEVVM_BIN:$WORK/nocode:/usr/bin:/bin:/usr/sbin:/sbin
|
|
exec sh -c ': > "$STUB_LOG"'
|
|
! exec devvm code
|
|
stderr '^devvm: no_code_command host=devvm-web-[0-9a-f]{14}$'
|
|
stub_calls
|
|
! stdout '^code '
|
|
env PATH=$SAVED_PATH
|
|
|
|
# Network policy: a VM devvm started confined that still reaches the
|
|
# internet directly is stopped, as on a launch; no host name. (Its
|
|
# hostagent here: the test's runner, which runs on, in place of the
|
|
# stub's.)
|
|
mkdir $WORK/leak
|
|
cd $WORK/leak
|
|
exec devvm --network-policy --no-git-protect base
|
|
exec sh -c 'n=$(basename "$VMS"/devvm-leak-*); echo $PPID > "$LIMA_HOME/$n/ha.pid"; echo "$PPID 1" > "$XDG_DATA_HOME/devvm/run/$n.started"'
|
|
exec sh -c ': > "$STUB_LOG" && : > "$STUB_DIR/net-direct"'
|
|
! exec devvm host
|
|
stderr '^devvm: net_direct_route vm=devvm-leak-[0-9a-f]{14}$'
|
|
! stdout ssh_host_info
|
|
stub_calls
|
|
stdout '^limactl stop devvm-leak-[0-9a-f]{14}$'
|
|
! stdout 'tar -xf'
|
|
rm $STUB_DIR/net-direct
|