mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 21:36:40 -10:00
Pinning or forgetting a VM's host keys takes known_hosts.lock (an OS file lock, paths.Dirs.KnownHostsLock), reads the file again inside it and writes it whole with state.WriteFile, so two devvms at once lose neither's pin. ForgetHostKeys takes its caller's ctx. TestHostKeyConcurrent holds two pins' reads until both have read; it fails on the unlocked code. Co-Authored-By: Claude Opus 5.5 <[email protected]>
220 lines
4.8 KiB
Plaintext
220 lines
4.8 KiB
Plaintext
# devvm's folders: their layout version, checked before every command
|
|
# that reads them, and every file devvm keeps for a VM with network
|
|
# policy, ports, a link and a secret, against the listings below. A
|
|
# change to the layout changes a listing: consider the layout version
|
|
# then (Contributing's state layout).
|
|
|
|
# The first run gives both folders this devvm's version.
|
|
exec devvm ls
|
|
cmp $DATA/version want/version
|
|
cmp $CFG/version want/version
|
|
|
|
# A newer devvm's folders are refused, before the command runs, and so
|
|
# is a version file devvm can't read; help, completion and the version
|
|
# still run.
|
|
cp want/newer $DATA/version
|
|
! exec devvm ls
|
|
stderr '^devvm: layout_newer current=1 path=\S+/data/devvm/version version=2$'
|
|
! stdout .
|
|
exec devvm --version
|
|
exec devvm version
|
|
exec devvm help
|
|
exec devvm completion bash
|
|
cmp $DATA/version want/newer
|
|
cp want/version $DATA/version
|
|
cp want/newer $CFG/version
|
|
! exec devvm doctor
|
|
stderr '^devvm: layout_newer current=1 path=\S+/config/devvm/version version=2$'
|
|
cp want/corrupt $CFG/version
|
|
! exec devvm ls
|
|
stderr '^devvm: layout_unchecked reason=\S+/config/devvm/version: not a layout version$'
|
|
rm $CFG/version
|
|
exec devvm ls
|
|
cmp $CFG/version want/version
|
|
|
|
# A target VM that publishes a port, and a client VM with a link to it
|
|
# and a secret, both with network policy and forwarding a port, one free
|
|
# on this host, so the forwarders start whatever else listens.
|
|
free_port PORT
|
|
exec devvm ports -g $PORT
|
|
project db
|
|
exec devvm --network-policy --no-git-protect
|
|
exec devvm link publish 5432
|
|
project app
|
|
exec devvm --network-policy --no-git-protect
|
|
exec devvm link add db 5432
|
|
stdin $WORK/github.token
|
|
exec devvm secret set github --stdin
|
|
exec devvm secret use github
|
|
vm_name APP app
|
|
vm_name DB db
|
|
vm_state $APP_dir/vm.json
|
|
stdout '^made_by=\S+$'
|
|
|
|
# Every file and folder, with the VMs' hashes named and other hashes,
|
|
# times and versions left out.
|
|
exec sh $WORK/list.sh $CFG
|
|
cmp stdout $WORK/config.txt
|
|
exec sh $WORK/list.sh $DATA
|
|
[darwin] cmp stdout $WORK/data.txt
|
|
[!darwin] cmp stdout $WORK/data-linux.txt
|
|
|
|
-- want/version --
|
|
1
|
|
-- want/newer --
|
|
2
|
|
-- want/corrupt --
|
|
one
|
|
-- github.token --
|
|
ghp_testfake
|
|
-- list.sh --
|
|
# list.sh FOLDER: every path under FOLDER, sorted, with APP's and DB's
|
|
# hashes named and other hashes, times, versions and QEMU's architecture
|
|
# as X.
|
|
cd "$1" || exit 1
|
|
find . -mindepth 1 | sed -E \
|
|
-e 's|^\./||' -e 's/qemu-system-[a-z0-9_]+/qemu-system-X/' \
|
|
-e "s/${APP##*-}/APP/g" -e "s/${DB##*-}/DB/g" \
|
|
-e 's/[0-9a-f]{12,}/X/g' -e 's/[0-9]{8}-[0-9]{6}-[0-9]+/X/g' -e 's/[0-9]+\.[0-9]+\.[0-9]+/X/g' |
|
|
LC_ALL=C sort -u
|
|
-- config.txt --
|
|
version
|
|
-- data.txt --
|
|
ca
|
|
ca/ca.key
|
|
ca/ca.pem
|
|
groups.lock
|
|
images
|
|
images/X
|
|
images/X/record.json
|
|
images/locks
|
|
images/locks/X
|
|
known_hosts
|
|
known_hosts.lock
|
|
logs
|
|
logs/runs
|
|
logs/runs/X.log
|
|
making.lock
|
|
run
|
|
run/builds
|
|
run/claims.lock
|
|
run/link-X.ctl
|
|
run/link-X.sock
|
|
settings.json
|
|
ssh_config
|
|
tools
|
|
version
|
|
version.lock
|
|
vms
|
|
vms/APP
|
|
vms/APP/lock
|
|
vms/APP/logs
|
|
vms/APP/logs/links.log
|
|
vms/APP/logs/network.jsonl
|
|
vms/APP/logs/ports.log
|
|
vms/APP/logs/proxy.log
|
|
vms/APP/run
|
|
vms/APP/run/links.json
|
|
vms/APP/run/links.pid
|
|
vms/APP/run/ports.known_hosts
|
|
vms/APP/run/ports.lock
|
|
vms/APP/run/ports.pid
|
|
vms/APP/run/ports.status
|
|
vms/APP/run/proxy.json
|
|
vms/APP/run/proxy.pid
|
|
vms/APP/run/proxy.status
|
|
vms/APP/run/sandbox.sb
|
|
vms/APP/run/secrets.json
|
|
vms/APP/run/secrets.policy
|
|
vms/APP/run/started
|
|
vms/APP/vm.json
|
|
vms/DB
|
|
vms/DB/lock
|
|
vms/DB/logs
|
|
vms/DB/logs/network.jsonl
|
|
vms/DB/logs/ports.log
|
|
vms/DB/logs/proxy.log
|
|
vms/DB/run
|
|
vms/DB/run/ports.known_hosts
|
|
vms/DB/run/ports.lock
|
|
vms/DB/run/ports.pid
|
|
vms/DB/run/ports.status
|
|
vms/DB/run/proxy.json
|
|
vms/DB/run/proxy.pid
|
|
vms/DB/run/proxy.status
|
|
vms/DB/run/sandbox.sb
|
|
vms/DB/run/secrets.json
|
|
vms/DB/run/secrets.policy
|
|
vms/DB/run/started
|
|
vms/DB/vm.json
|
|
-- data-linux.txt --
|
|
ca
|
|
ca/ca.key
|
|
ca/ca.pem
|
|
groups.lock
|
|
images
|
|
images/X
|
|
images/X/record.json
|
|
images/locks
|
|
images/locks/X
|
|
known_hosts
|
|
known_hosts.lock
|
|
logs
|
|
logs/runs
|
|
logs/runs/X.log
|
|
making.lock
|
|
run
|
|
run/builds
|
|
run/claims.lock
|
|
run/link-X.ctl
|
|
run/link-X.sock
|
|
run/qemu
|
|
run/qemu/qemu-system-X
|
|
secrets
|
|
secrets/github
|
|
settings.json
|
|
ssh_config
|
|
tools
|
|
version
|
|
version.lock
|
|
vms
|
|
vms/APP
|
|
vms/APP/lock
|
|
vms/APP/logs
|
|
vms/APP/logs/links.log
|
|
vms/APP/logs/network.jsonl
|
|
vms/APP/logs/ports.log
|
|
vms/APP/logs/proxy.log
|
|
vms/APP/run
|
|
vms/APP/run/links.json
|
|
vms/APP/run/links.pid
|
|
vms/APP/run/ports.known_hosts
|
|
vms/APP/run/ports.lock
|
|
vms/APP/run/ports.pid
|
|
vms/APP/run/ports.status
|
|
vms/APP/run/proxy.json
|
|
vms/APP/run/proxy.pid
|
|
vms/APP/run/proxy.status
|
|
vms/APP/run/secrets.json
|
|
vms/APP/run/secrets.policy
|
|
vms/APP/run/started
|
|
vms/APP/vm.json
|
|
vms/DB
|
|
vms/DB/lock
|
|
vms/DB/logs
|
|
vms/DB/logs/network.jsonl
|
|
vms/DB/logs/ports.log
|
|
vms/DB/logs/proxy.log
|
|
vms/DB/run
|
|
vms/DB/run/ports.known_hosts
|
|
vms/DB/run/ports.lock
|
|
vms/DB/run/ports.pid
|
|
vms/DB/run/ports.status
|
|
vms/DB/run/proxy.json
|
|
vms/DB/run/proxy.pid
|
|
vms/DB/run/proxy.status
|
|
vms/DB/run/secrets.json
|
|
vms/DB/run/secrets.policy
|
|
vms/DB/run/started
|
|
vms/DB/vm.json
|