How to build the Mac VM image¶
Rebuild the image after changing deploy/vmimage/feature/ or anything
build.sh stages into it: deploy/linux's units, egress.nft, the CNI
conflist, or gVisor. Every step runs on an Apple-silicon Mac as you, never
as root. Mac VM image describes what the
image holds; deploy/vmimage/build.sh --help and check.sh --help describe
the scripts.
Steps¶
-
Bump
IMAGE_REVISIONindeploy/vmimage/build.sh. The runner pins the image by name and sha512, so every change needs a new revision. -
Remove the previous revision's files from
dist/vmimage/. The check and cache recipes below want exactly one image there, and a build replaces only files of its own name. -
Build it:
The image, its sums and
build.logland indist/vmimage/. -
Boot it in a scratch VM and check it:
The check also measures the VM's idle footprint. A change must not raise it above the bar in Mac VM image; boot a few times, since footprints vary by about 20 MB between boots.
-
Copy it into an installed runner's cache, which also prints its sha512. Until the image is published as a release asset, this is how a runner gets it.
-
Pin the new image in
internal/vmimage/vmimage.go:File,URL,SHA512, andstagedSources, the hashes of the files the build staged. A test fails whilestagedSourcesdoesn't match the repository. If the image has grown, checkmaxBytes, the most the runner will download, against the new size. -
Roll it out: the pin is compiled into the runner, so build it with
just build-darwinand upgrade each Mac runner. Each one recreates its VM from the new image.
If a build fails while its VM is still running, just vm-image keeps the
scratch Lima home and prints the commands to remove it.