mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 16:27:33 -10:00
devvm's files keep only Ubuntu's release (26.04) and its cloud image key. The first build of base on a machine pins the newest dated release whose SHA256SUMS carry a valid signature from that key and list an image for the host (state.UbuntuPin, images/ubuntu.json), and every later build uses the pin without looking anything up. devvm rebuild base pins the newest again. The pin is in base's recipe, so base's key hashes it. The signature is checked in Go (internal/ubuntu/pgp.go: OpenPGP v4 RSA signatures with SHA-256/384/512, the standard library's crypto), so no gpgv is needed and a host without one is no longer unchecked. - backend.Images gains PinOrigin (backend.Pin: PinFirst, PinNewest, PinOlder); internal/build pins before it keys a build, and says what it pinned (origin_pinned). - Lima: Origin and createFromUbuntu read the pin; PinOrigin finds the newest with ubuntu.Finder (Newest, Release) under images/locks/ubuntu; a --from conversion pins only when nothing is. - Messages: ubuntu_unreachable and no_ubuntu_release; ubuntu_unsigned and ubuntu_checksum_unpinned are gone. - e2e pins its own release (DEVVM_UBUNTU_RELEASE, a test override; scripts/bump.sh e2e-ubuntu moves it); bump.sh's apt moves the package snapshot alone. The gpgv stub is gone. - Tests: the verifier against Ubuntu's real signature and a test key (damaged keys and signatures, packet and subpacket lengths, armor), Newest/Release, PinOrigin, the pin record, and the key covering the pin. Co-Authored-By: Claude Opus 5.5 <[email protected]>
103 lines
2.8 KiB
Plaintext
103 lines
2.8 KiB
Plaintext
# The scripts' own commands, which every other script uses.
|
|
|
|
# The sandbox shows messages by name and names devvm's folders.
|
|
exec sh -c 'test "$DEVVM_MESSAGES" = names && test "$DATA" = "$XDG_DATA_HOME/devvm" && test "$VMS" = "$DATA/vms" && test "$RUN" = "$DATA/run" && test "$CFG" = "$XDG_CONFIG_HOME/devvm"'
|
|
|
|
# stub_reset forgets the stubs' calls, and empties stdout as an exec does.
|
|
exec open x
|
|
stub_calls
|
|
stdout '^open x$'
|
|
stub_reset
|
|
! stdout .
|
|
! stub_calls
|
|
exec open y
|
|
stub_calls
|
|
cmp stdout calls
|
|
|
|
# catg cats the one file a glob matches; a glob matching none or two
|
|
# fails it.
|
|
mkdir $VMS/0123456789abcd
|
|
cp vm.json $VMS/0123456789abcd/vm.json
|
|
catg $VMS/*/vm.json
|
|
cmp stdout vm.json
|
|
! catg $VMS/*/policy
|
|
cp vm.json $VMS/0123456789abcd/policy
|
|
! catg $VMS/0123456789abcd/*
|
|
catg $VMS/*/vm.json
|
|
cmp stdout vm.json
|
|
|
|
# vm_name sets a variable to the one VM whose state records a name made
|
|
# for a folder, and VAR_dir to its folder; a folder without state, another
|
|
# folder's VM, no VM or two fail it.
|
|
mkdir $VMS/0123456789abce
|
|
cp policy $VMS/0123456789abce/vm.json
|
|
vm_name WEB web
|
|
exec echo $WEB $WEB_dir
|
|
stdout '^devvm-web-0123456789abcd .*/vms/0123456789abcd$'
|
|
! vm_name API api
|
|
mkdir $VMS/fedcba98765432
|
|
cp other.json $VMS/fedcba98765432/vm.json
|
|
! vm_name WEB web
|
|
|
|
# vm_state prints a VM's state as sorted KEY=VALUE lines: a section's
|
|
# fields dotted, a list of strings space-separated, a list of objects by
|
|
# index, anything but a string as JSON.
|
|
vm_state $VMS/0123456789abcd/vm.json
|
|
cmp stdout flat
|
|
|
|
# json_set sets strings, any JSON with :=, and fields of objects by dotted
|
|
# keys, made when they're missing; the rest stays.
|
|
json_set $VMS/0123456789abcd/vm.json image=docker net.made.check=ok ports.host:={"ssh":2222} version:=2
|
|
vm_state $VMS/0123456789abcd/vm.json
|
|
stdout '^image=docker$'
|
|
stdout '^net.made.check=ok$'
|
|
stdout '^net.on=true$'
|
|
stdout '^ports.host.ssh=2222$'
|
|
stdout '^version=2$'
|
|
stdout '^tools.names=node claude$'
|
|
json_set $WORK/new.json a.b=c
|
|
exec cat $WORK/new.json
|
|
stdout '"a": \{\n "b": "c"\n \}'
|
|
|
|
# project makes a folder in $WORK and goes to it; with git, a repo.
|
|
project app
|
|
exec pwd
|
|
stdout '/app$'
|
|
! exists .git
|
|
project repo git
|
|
exec pwd
|
|
stdout '/repo$'
|
|
exists .git
|
|
|
|
-- calls --
|
|
open y
|
|
-- vm.json --
|
|
{
|
|
"version": 1,
|
|
"id": "x",
|
|
"name": "devvm-web-0123456789abcd",
|
|
"image": "base",
|
|
"dir": "/p",
|
|
"backend": "lima",
|
|
"net": {"on": true},
|
|
"tools": {"names": ["node", "claude"]},
|
|
"links": {"links": [{"name": "db", "port": 5432}]},
|
|
"secrets": {"names": []}
|
|
}
|
|
-- flat --
|
|
backend=lima
|
|
dir=/p
|
|
id=x
|
|
image=base
|
|
links.links.0.name=db
|
|
links.links.0.port=5432
|
|
name=devvm-web-0123456789abcd
|
|
net.on=true
|
|
secrets.names=
|
|
tools.names=node claude
|
|
version=1
|
|
-- policy --
|
|
example.com
|
|
-- other.json --
|
|
{"version": 1, "id": "y", "name": "devvm-web-fedcba98765432", "image": "base", "dir": "/q", "backend": "lima"}
|