fix(setup-mise): key the tools cache on the job image #62

Merged
cjournois merged 1 commit from fix/setup-mise-image-key into main 2026-10-08 14:26:24 +00:00
Collaborator

A cached mise tool can outlive the image it was built on. devops/ignite's CI has failed since 2026-10-06 because the cached yamllint venv points at a CPython uv downloaded into $HOME, which the cache doesn't hold. devops/image#87 now bakes that Python into ci-runner, but the stale entry keeps being restored: a hit never re-saves, and the mise-<os>-<arch>- restore-key prefix falls back to it even after mise.toml changes.

  • scripts/find-mise-config.sh also outputs image_key: 12 hex characters of a sha256 over the distro (ID/VERSION_ID), the uv python dir and its listing, and any system python3. Those are exactly what cached venvs and binaries depend on outside the cache, so unrelated image rebuilds don't empty every cache.
  • setup-mise's key becomes mise-<os>-<arch>-<image_key>-<hash(mise.toml)>, and its restore-key prefix includes image_key. Old entries never match again, so nobody has to purge the runner cache.

just lint test passes, 407/407, with 5 new bats cases. Run inside both ci-runner images, the key is stable within an image and differs across #87 (1c0b8986b05b → 081fd9aa45d5).

To reach ignite: merge, release 4.6.1 (just release 4.6.1), and Renovate bumps devops/ignite#17 to it.

A cached mise tool can outlive the image it was built on. devops/ignite's CI has failed since 2026-10-06 because the cached yamllint venv points at a CPython uv downloaded into `$HOME`, which the cache doesn't hold. devops/image#87 now bakes that Python into ci-runner, but the stale entry keeps being restored: a hit never re-saves, and the `mise-<os>-<arch>-` restore-key prefix falls back to it even after mise.toml changes. - `scripts/find-mise-config.sh` also outputs `image_key`: 12 hex characters of a sha256 over the distro (`ID`/`VERSION_ID`), the uv python dir and its listing, and any system `python3`. Those are exactly what cached venvs and binaries depend on outside the cache, so unrelated image rebuilds don't empty every cache. - setup-mise's key becomes `mise-<os>-<arch>-<image_key>-<hash(mise.toml)>`, and its restore-key prefix includes `image_key`. Old entries never match again, so nobody has to purge the runner cache. `just lint test` passes, 407/407, with 5 new bats cases. Run inside both ci-runner images, the key is stable within an image and differs across #87 (`1c0b8986b05b` → `081fd9aa45d5`). To reach ignite: merge, release `4.6.1` (`just release 4.6.1`), and Renovate bumps devops/ignite#17 to it.
fix(setup-mise): key the tools cache on the job image
All checks were successful
ci: reusable-pipeline / CI Pipeline (pull_request) Successful in 31s
ci: reusable-pipeline / CI Pipeline (push) Successful in 30s
aa5fdbd5a9
A cache entry built on another ci-runner image restored uv tool venvs whose
interpreter lived outside the cache, so tools failed with "couldn't exec process".
The key and restore-key prefix now carry a fingerprint of the distro and the uv
python dir; verified 1c0b8986b05b (sha-b38735b5) vs 081fd9aa45d5 (sha-736352c2).
cjournois deleted branch fix/setup-mise-image-key 2026-10-08 14:26:24 +00:00
Sign in to join this conversation.
No reviewers
No labels
needs-human
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cjournois/reusable-pipeline!62
No description provided.