mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
Lima's download of the cloud image neither retries nor times out: one cut in its 900 MB fails base's build, and a stall hangs it. devvm now downloads the pinned image itself through fetch.Resumable (ubuntu.Download), into images/ubuntu/<sha256>.img (Dirs.UbuntuImage), resuming across cuts, stalls and runs, and gives Lima that file. Lima 2.3 checks a local file against the digest before it copies it. - Before downloading, it takes the image from Lima's own download cache when that holds it with the pin's SHA-256: copied into a new file of devvm's own, mode 600, hashed as it's written, capped, stopped by the context, and kept only once it checks out. Lima's cache is never changed, and a base whose dated release Ubuntu may have removed still builds again. - One devvm downloads at a time (images/locks/ubuntu-image), another waiting under ubuntu_image_waiting and looking again under the lock (TestUbuntuImageAfterWait, which fails without that second look). - The download goes through the company proxy and trusts the user's CAs (Lima.Roots, from trust.Pool, which internal/cli passes through the registry), as do the Finder's lookups (TestNewTrustsRoots, and the registry's TestOverrides). An untrusted certificate is ubuntu_untrusted, naming the CAs' folder, one from a trusted CA that's for another host, out of date or not valid yet ubuntu_bad_certificate (check the clock and what answers for the host), and any other that fails to verify (a SHA-1 signature, a CA's name constraints, a key for clients alone) ubuntu_certificate_invalid, naming Go's reason, for the lookups (the listing, the checksums, their signature: TestLookupCertificates) and the download alike (TestLocalImageFailsFor), and a release Ubuntu removed (404, 410) ubuntu_release_gone, which names devvm rebuild base; none is retried. ubuntu_download_failed no longer starts with devvm. - fetch.Untrusted, fetch.BadCertificate (an x509.HostnameError, or a CertificateInvalidError that's Expired) and fetch.Unverified (any failure to verify, with its reason, so every error the other two name), beside fetch.Gone, are the one place that tells a certificate's failures apart: Transient asks Unverified, the lookups and the download ask all three, host mise asks Untrusted, and a forbidigo rule keeps x509's and tls's verification errors in internal/fetch (TestCertificateClasses, TestTransient, testdata/lint, the owners doc's row). - An https address, or a test build's file:// DEVVM_UBUNTU_URL, read from disk the same way; anything else is refused. The CLI tests' sandbox has a stand-in of this host's image in the store. - Base's record keeps the image's address, and the key is as it was: it hashes the pin (release, file, digest), not the location. - devvm gc --caches frees devvm's copies that no record names and that aren't pinned now, unchanged for an hour, a stopped .part and a killed import's .import included, and those of a kept image once its .img is there. A pin it can't read fails it. - Of Lima's cache, it frees only an entry that devvm's own state shows a build of devvm's left: a base record names its address, devvm has its own copy of the image, and the installed Lima's own templates (share/lima/templates beside limactl, Lima.Templates) don't name it. An entry no record names may be the user's own Lima's, so it stays, and none is freed when the templates can't be read, with a line in the run log naming the folder and why. A test build's DEVVM_LIMA_TEMPLATES stands in for the templates folder. - ubuntu.ParseImage reads a record's image as Image.String writes it, and ubuntu.IsSHA256 is the one check of a cloud image's SHA-256, in place of Lima's own regex. - devvm space shows the copies as a cloud images row, freed by gc --caches, kept as state, as a release Ubuntu removed can't be downloaded again. 0.1.0's frozen state runs the new commands (fixture_v010_cloud_image): devvm looks in Lima's cache under the SHA-256 of the address 0.1.0's base record keeps and never changes the entry, base builds from devvm's own copy, and gc --caches keeps that copy, frees Lima's entry the record names and devvm's own stale copies, and keeps an older entry no record names. Docs: images.md (the download, its failures, the import, gc's rules), space.md, backends/lima.md, settings.md (the lookups and the download trust your CAs), troubleshooting.md, overview.md, testing.md, tests.md, structure.md's internal/fetch row; the CHANGELOG's two Fixed lines, which later commits make highlights, What to do 5 and 6, and the release page's Ubuntu's cloud image in devvm's folder. New messages: downloading_ubuntu, importing_ubuntu, ubuntu_image_waiting, ubuntu_download_failed, ubuntu_release_gone, ubuntu_bad_certificate, ubuntu_certificate_invalid, ubuntu_image_checksum, ubuntu_untrusted. Lima.LocalImage is the seam, Lima.ImageClient the client. Co-Authored-By: Claude Opus 5.5 <[email protected]>
279 lines
6.3 KiB
Plaintext
279 lines
6.3 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 allowlist --no-git-protect
|
|
exec devvm link publish 5432
|
|
project app
|
|
exec devvm --network allowlist --no-git-protect
|
|
exec devvm link add db 5432
|
|
stdin $WORK/github.token
|
|
exec devvm secret set github --stdin
|
|
exec devvm secret use github
|
|
stdin $WORK/stripe.token
|
|
exec devvm secret set stripe --host api.stripe.com --env STRIPE_API_KEY --stdin
|
|
exec devvm secret use stripe
|
|
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. Each VM's start holds its ssh port for a
|
|
# minute (run/ports.ssh-hold in its folder).
|
|
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
|
|
-- stripe.token --
|
|
sk_test_fake
|
|
-- 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 --
|
|
custom-secrets.json
|
|
custom-secrets.lock
|
|
groups.lock
|
|
images
|
|
images/X
|
|
images/X/record.json
|
|
images/locks
|
|
images/locks/X
|
|
images/locks/packages
|
|
images/locks/ubuntu
|
|
images/ubuntu
|
|
images/ubuntu.json
|
|
images/ubuntu/X.img
|
|
logs
|
|
logs/runs
|
|
logs/runs/X.log
|
|
making.lock
|
|
packages
|
|
packages/sets
|
|
packages/sets/X.json
|
|
run
|
|
run/build-ports
|
|
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/ca
|
|
vms/APP/run/ca/ca.key
|
|
vms/APP/run/ca/ca.pem
|
|
vms/APP/run/ca/lock
|
|
vms/APP/run/ca/next.key
|
|
vms/APP/run/ca/next.pem
|
|
vms/APP/run/known_hosts
|
|
vms/APP/run/links.json
|
|
vms/APP/run/links.pid
|
|
vms/APP/run/ports.forwarded
|
|
vms/APP/run/ports.lock
|
|
vms/APP/run/ports.pid
|
|
vms/APP/run/ports.ssh-hold
|
|
vms/APP/run/ports.status
|
|
vms/APP/run/proxy-child.pid
|
|
vms/APP/run/proxy.confined
|
|
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/ca
|
|
vms/DB/run/ca/ca.key
|
|
vms/DB/run/ca/ca.pem
|
|
vms/DB/run/ca/lock
|
|
vms/DB/run/ca/next.key
|
|
vms/DB/run/ca/next.pem
|
|
vms/DB/run/known_hosts
|
|
vms/DB/run/ports.forwarded
|
|
vms/DB/run/ports.lock
|
|
vms/DB/run/ports.pid
|
|
vms/DB/run/ports.ssh-hold
|
|
vms/DB/run/ports.status
|
|
vms/DB/run/proxy-child.pid
|
|
vms/DB/run/proxy.confined
|
|
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 --
|
|
custom-secrets.json
|
|
custom-secrets.lock
|
|
groups.lock
|
|
images
|
|
images/X
|
|
images/X/record.json
|
|
images/locks
|
|
images/locks/X
|
|
images/locks/packages
|
|
images/locks/ubuntu
|
|
images/ubuntu
|
|
images/ubuntu.json
|
|
images/ubuntu/X.img
|
|
logs
|
|
logs/runs
|
|
logs/runs/X.log
|
|
making.lock
|
|
packages
|
|
packages/sets
|
|
packages/sets/X.json
|
|
run
|
|
run/build-ports
|
|
run/builds
|
|
run/claims.lock
|
|
run/link-X.ctl
|
|
run/link-X.sock
|
|
run/qemu
|
|
run/qemu/qemu-system-X
|
|
secrets
|
|
secrets/custom.stripe
|
|
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/ca
|
|
vms/APP/run/ca/ca.key
|
|
vms/APP/run/ca/ca.pem
|
|
vms/APP/run/ca/lock
|
|
vms/APP/run/ca/next.key
|
|
vms/APP/run/ca/next.pem
|
|
vms/APP/run/known_hosts
|
|
vms/APP/run/links.json
|
|
vms/APP/run/links.pid
|
|
vms/APP/run/ports.forwarded
|
|
vms/APP/run/ports.lock
|
|
vms/APP/run/ports.pid
|
|
vms/APP/run/ports.ssh-hold
|
|
vms/APP/run/ports.status
|
|
vms/APP/run/proxy-child.pid
|
|
vms/APP/run/proxy.confined
|
|
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/ca
|
|
vms/DB/run/ca/ca.key
|
|
vms/DB/run/ca/ca.pem
|
|
vms/DB/run/ca/lock
|
|
vms/DB/run/ca/next.key
|
|
vms/DB/run/ca/next.pem
|
|
vms/DB/run/known_hosts
|
|
vms/DB/run/ports.forwarded
|
|
vms/DB/run/ports.lock
|
|
vms/DB/run/ports.pid
|
|
vms/DB/run/ports.ssh-hold
|
|
vms/DB/run/ports.status
|
|
vms/DB/run/proxy-child.pid
|
|
vms/DB/run/proxy.confined
|
|
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
|