Skip to content

Fail CI in minutes, not an hour, when Ubuntu's mirror stops answering - #240

Merged
itz4blitz merged 1 commit into
mainfrom
ci/bounded-apt
Nov 11, 2026
Merged

itz4blitz merged 1 commit into
mainfrom
ci/bounded-apt

Conversation

@itz4blitz

Copy link
Copy Markdown
Collaborator

What changed and why

This morning the GitHub runners couldn't reach Ubuntu's package mirror. packaging/ci/apt.sh waited out every package in turn, so each Linux job sat in setup for 48 to 58 minutes before it built anything. No job had a timeout, so nothing would have stopped them before GitHub's 6-hour limit. With this change, a dead mirror fails the job in under two minutes with an error that says to re-run it, and no build job can run past about twice its slowest time.

  • apt.sh:
    • The update fails when any index does not download (--error-on=any), instead of carrying on with stale lists.
    • Each request gives up after 20 s.
    • The update is capped at 2 min and the download at 10.
    • A failed try runs once more after a minute.
    • The install only reads what was downloaded and is never cut short, because a dpkg killed halfway breaks the retry.
  • Timeouts:
    • CI: test 60 min (macOS has taken 30), package 45 (slowest 16).
    • Mobile: both jobs 30 (slowest 10).
    • Release: the three build jobs 90, linux-smoke 30.
    • Release also runs apt.sh, so a tag build gets the same bound.

Type

  • feature
  • fix
  • perf
  • refactor
  • chore
  • docs

Platforms

  • windows
  • macos
  • linux
  • android
  • ios

Proof

CI change, no app behaviour. I ran the new apt.sh in ubuntu:22.04 containers:

  • Working mirror: installed every package from a bare image and exited 0 in 261 s. A runner already has most of them and normally takes about 75 s.
  • Mirror hanging, with the Ubuntu hosts pointed at an unroutable address: it failed both tries with the error and exited 1 in 108 s. The same failure held this morning's jobs for close to an hour.

This PR's own Linux jobs run the new script against the real mirror.

Compatibility

CI only.

Risk and rollback

--error-on=any turns any index download failure into a failed try, where apt used to ignore it. A blip clears on the retry a minute later. A longer outage now fails the job, where it used to hang, and the job needs a re-run either way. Rollback: revert the commit.

Release note

None (CI only).

🤖 Generated with Claude Code

On 2026-11-11 the GitHub runners could not reach Ubuntu's package mirror. apt waited out every
package in turn, and the Linux jobs sat in setup for 48 to 58 minutes before anything built.
Nothing bounded them: no job had a timeout, so GitHub's six hours was the limit.

apt.sh now fails the update when an index does not download, gives each request 20 seconds,
caps the update at 2 minutes and the download at 10, and tries once more after a minute.
The install reads only what was downloaded and is never cut short. Against a mirror that
does not answer it fails in under two minutes; against a working one it installs as before.

Every CI, Mobile and Release build job also has a timeout, about twice its slowest run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@itz4blitz
itz4blitz merged commit a955568 into main Nov 11, 2026
7 checks passed
@itz4blitz
itz4blitz deleted the ci/bounded-apt branch November 11, 2026 17:49
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