Skip to content

ci(tmachine): key the CI disk cache on tmachine's own layer hash #5627

Open

Description

@matthewgrossman

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_hash already computes), such as tmachine layer-key <environment>.
  • In e2e-suites.yml, use that value as the cache key (with the OS and arch), in place of the hashFiles(...) list and the comment that explains it.
  • Keep the cache restricted to setup layers (~/.cache/tmachine/disks/*.qcow2).

To check while implementing:

  • Whether setup_hash needs 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 disks step in e2e-suites.yml keys 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

  1. added
    area:buildCI/CD workflows, releases, build targets, packaging, and artifact publication.
    on Nov 16, 2026
  2. added
    topic:testingUnit, integration, regression, conformance, E2E tests, coverage, flakes, and test infrastructure.
    on Nov 16, 2026
  3. added a commit that references this issue on Nov 17, 2026
    64e1e8c
  4. added a commit that references this issue on Nov 18, 2026
    13db26b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:buildCI/CD workflows, releases, build targets, packaging, and artifact publication.topic:testingUnit, integration, regression, conformance, E2E tests, coverage, flakes, and test infrastructure.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions