Repository navigation
Description
User Story
I maintain OpenShell's end-to-end tests. The Branch E2E rows boot tmachine VMs, and CI caches their disks across runs. I need that cache key to change exactly when tmachine's own layer hash changes, so that adding a setup input can't silently turn every run into a cache miss.
Description
tmachine names each setup layer disks/<hash>.qcow2, where the hash is a blake3 over the base image, the Ansible tree, the environment's playbooks and its input files (setup_hash in tests/tmachine/src/qemu/setup.rs). .github/workflows/e2e-suites.yml keys actions/cache on a separate, hand-written hashFiles(...) list that approximates that hash.
The two lists drift. When a new input reaches tmachine's hash but not the workflow key, the key still hits and restores the old disks. tmachine misses on its own hash and rebuilds the layer, and actions/cache does not save after an exact key hit, so the rebuilt layer is never stored. Every later run rebuilds it, with no error.
Proposal:
- Add a tmachine subcommand that prints an environment's setup-layer hash (the value
setup_hashalready computes), such astmachine layer-key <environment>. - In
e2e-suites.yml, use that value as the cache key (with the OS and arch), in place of thehashFiles(...)list and the comment that explains it. - Keep the cache restricted to setup layers (
~/.cache/tmachine/disks/*.qcow2).
To check while implementing:
- Whether
setup_hashneeds the base image resolved first, and what that costs on a cold runner (a Nix build or download before the cache step). - Whether tmachine is already built before the cache step.
- Whether the key should cover all of an environment's layers or only its setup layer (install layers are not cached).
Context
Found while reviewing #5608, which caches the ubuntu-k3s setup layers and moves install layers out of the cached directory.
Related: #5433 (shrink the row Nix download).
Part of #5281.
Definition of Done
- tmachine prints an environment's setup-layer hash without booting a VM.
- The
Cache tmachine disksstep ine2e-suites.ymlkeys on that value; no hand-maintained file list remains. - Adding an input to an environment's setup changes the cache key without any workflow edit.
- A cold-runner run and a warm-cache run both pass, and the warm run restores the setup layers.
Activity
ci(e2e): key the tmachine disk cache on the setup layer hash
ci(e2e): key the tmachine disk cache on the setup layer hash