Skip to content

ci: cache LibreOffice .debs and fall back off a stalled Azure apt mirror - #55

Merged
kklimuk merged 1 commit into
mainfrom
ci/cache-libreoffice-debs
Nov 6, 2026
Merged

kklimuk merged 1 commit into
mainfrom
ci/cache-libreoffice-debs

Conversation

@kklimuk

@kklimuk kklimuk commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Why

#50, #51 and #52 are red on Integration Tests (LibreOffice), all killed at the 5-minute cap on Install LibreOffice. That isn't a test failure. The runner's azure.archive.ubuntu.com mirror served the ~100 MB of LibreOffice .debs at ~35 KB/s (the first 7.4 MB package took 3m15s), while apt-get update metadata still came down at 10 MB/s. Healthy runs install in 15–21s. Acquire::Retries doesn't help, because a slow transfer never errors.

What

  • Cache the .debs with actions/cache/restore + save. The key is built from the resolved package filenames (name_version_arch), so it changes only when Ubuntu ships a new build. restore-keys gives partial hits, so apt downloads only what's missing. apt verifies every cached .deb against the signed index, so a stale or corrupt entry gets re-fetched, never installed.
  • Mirror fallback. The download runs download-only with a 120s cap per attempt. If that stalls, the mirrorlist is switched to archive.ubuntu.com, apt-get update runs again, and the download retries. Install then runs with --no-download, so a timeout can't interrupt dpkg partway through.
  • Save before the tests. The cache is saved right after the download, so a red test run still warms it. autoclean runs before the save so old versions don't pile up, and the save key is recomputed from the package lists that were actually downloaded against.
  • shell: bash on the job (pipefail), so a failed --print-uris fails the step instead of producing a key from an empty package list.
  • CONTRIBUTING.md CI section updated.

Verification

This can only be tested on GitHub's runners. The YAML parses locally, but neither actionlint nor Docker is available here. Things to check on this PR's run:

  • First run: a cache miss, a normal download, and the Stage step saves libreoffice-debs-ubuntu-26.04-X64-…
  • A re-run: an exact cache hit and no .deb downloads in the Download step
  • Integration tests pass

Reviewed with /code-review --fix (6 of 8 findings fixed). The two skipped: Resolve's apt-get update has no mirror fallback, since metadata stayed fast during the stall; and the mirror switch isn't checked against future runner images.

🤖 Generated with Claude Code

Three PRs (#50, #51, #52) went red on the integration job's Install
LibreOffice step, killed at its 5-minute cap. Not a code failure: the
runner's azure.archive.ubuntu.com mirror served the ~100 MB of .debs at
~35 KB/s while metadata stayed fast. Acquire::Retries can't help, since a
slow transfer never errors.

- Resolve the exact package set after `apt-get update` and key an
  actions/cache entry on the .deb filenames (name_version_arch, not URIs,
  so a mirror switch doesn't change the key). restore-keys gives partial
  hits; apt fetches only what's missing and verifies every cached .deb
  against the signed index.
- Download-only with a per-attempt timeout; a stalled first attempt
  rewrites the mirrorlist to archive.ubuntu.com and retries. Install then
  runs with --no-download, so a timeout never interrupts dpkg.
- Save right after download (not post-job) so a red test run still warms
  the cache; autoclean before saving so old versions don't accumulate, and
  re-key from the lists actually downloaded against.
- Job-level `shell: bash` for pipefail, so a failed --print-uris fails the
  step instead of keying on an empty list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kklimuk
kklimuk merged commit cb2c0de into main Nov 6, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant