Skip to content

ci: the Tier 2 containers use another apt mirror on each attempt, the runner's own first - #5513

Merged
vpacher merged 2 commits into
masterfrom
fix/5510-container-apt-mirrors
Nov 23, 2026
Merged

vpacher merged 2 commits into
masterfrom
fix/5510-container-apt-mirrors

Conversation

@vpacher

@vpacher vpacher commented Nov 23, 2026

Copy link
Copy Markdown
Member

Problem

The Tier 2 Linux container jobs fetch from one Ubuntu mirror (#5510). On 2026-11-23, apt-get update in the build job's Install Git 📦 hung for its full 180 s bound in all 3 attempts (run 45159376402, #5508), and #5142 failed in 3 different apt steps.

A mirror list (apt's mirror+file:) does not fix this. Test in ubuntu:26.04 (apt 3.2), with a fake first mirror that accepts connections and never answers, and archive.ubuntu.com second: apt-get update under timeout 180 exits 124 with Retries 0, 1 or 3 and Timeout 10 or 20 s. apt falls back file by file, waits the full timeout on the dead mirror for each index file, and never drops it.

The hosted runners are also not always in Azure: the host jobs of the same day fetched from http://us-east-2.ec2.archive.ubuntu.com and https://archive.ubuntu.com.

Change

Another mirror on each attempt, the runner's own first:

  • ci/host_apt_mirrors.py: container_mirrors() returns the runner's mirror (the first plain-HTTP, non-security entry of its apt mirror list, lowest priority first) and then FALLBACK_MIRRORS: http://archive.ubuntu.com/ubuntu/ and http://mirrors.edge.kernel.org/ubuntu/ (kernel.org's CDN). These are plain HTTP because the stock container has no CA certificates before Install Git 📦.
  • The Tier 2 build job mounts the host's /etc/apt read-only at /run/host-apt. It mounts the whole directory, not the file: a missing file would make Docker create a directory in its place on a persistent runner.
  • Install Git 📦 (the non-prebaked path) points the main source at the next mirror before each attempt and prints it. The step runs before checkout and uv, so it carries the same rule as awk. Without a host list it uses the fallbacks. Without the stock security stanza it keeps the image's sources and says so. The prebaked path does not change.
  • ci-runtime.py: the runtime delta starts at the runner's mirror, and its timeout retry (ci: a timed-out Tier 2 runtime delta install retries once after dpkg recovery #5508) fetches the index from the next one. The switch is one sh -c that changes nothing on an unknown layout.
  • The security pocket keeps security.ubuntu.com, which answered in every test.
  • docs/ci-tooling.md describes it.

No user-visible change, so no features ledger line. No new workflow file.

Tests

Check RED (081389b, stubs) GREEN
test_host_apt_mirrors.ContainerMirrorsTest: the order for Azure and AWS runner lists, a list after the host priority swap, ties, no priority, the archive as the runner's mirror (no duplicate), only HTTPS or security entries, an empty list, no list fails passes
test_tier2_apt_cache: Install Git 📦 uses another mirror on each attempt (Azure, archive, kernel.org; the security stanza unchanged) fails passes
test_tier2_apt_cache: the step's shell gives the same order as container_mirrors() for every case above fails passes
test_tier2_apt_cache: an unknown sources layout is kept; the build container mounts /etc/apt read-only fails passes
test_tier2_apt_cache.test_install_git_recovers_dpkg_before_each_retry (#5506), on the new shared harness passes passes
test_tier2_runtime_delta: the delta starts at the runner's mirror; the timeout retry uses the next mirror and refreshes the index; the switch keeps an unknown layout fails passes
All 85 ci/test_*.py modules that read build-project.yaml, ci-runtime or host_apt_mirrors pass on Linux

The new harness found a real bug before the push: without a host mirror list, awk failed on the missing file, pipefail passed that on, and the step ended. The GREEN commit handles it, and the "no list" case covers it.

Real run of the new step in ubuntu:26.04, with a host list that names a fake hanging mirror as the runner's own: attempt 1 (http://127.0.0.1:18081/ubuntu/) failed at its 180 s bound, attempt 2 (http://archive.ubuntu.com/ubuntu/) installed git. rc=0 after 198 s, dpkg --audit clean, security source unchanged. Before this change, the same case failed all 3 attempts.

Tiers 1 to 4 do not apply (CI only).

Test cost: no Rust tests. The new step cases run the step's shell with mocked apt-get and dpkg, about 0.5 s each.

Fixes #5510

🤖 Generated with Claude Code

vpacher and others added 2 commits November 23, 2026 14:07
… (Refs #5510)

On 2026-11-23 apt-get update hung for 180 s in all 3 attempts against
the one archive (run 45159376402). A mirror that accepts and never
answers keeps apt past its bound on every index file, and apt's mirror
method never drops it, so a mirror list does not help; another mirror
per attempt does. New cases, against stubs:
- host_apt_mirrors.container_mirrors: the runner's first plain-HTTP
  mirror, then http://archive.ubuntu.com and mirrors.edge.kernel.org;
- Install Git: each attempt points the main source at the next mirror,
  in that order (the step's shell against the same fixtures), keeps an
  unknown sources layout, and the job mounts the host's /etc/apt;
- ci-runtime.py: the delta starts at the runner's mirror, and its
  timeout retry fetches the index from the next one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…EN (Fixes #5510)

host_apt_mirrors.container_mirrors gives one mirror per attempt: the
runner's own (the first plain-HTTP, non-security entry of its apt mirror
list, lowest priority first), then http://archive.ubuntu.com/ubuntu/ and
http://mirrors.edge.kernel.org/ubuntu/.

The Tier 2 build container mounts the host's /etc/apt read-only at
/run/host-apt. Install Git points the main source at the next mirror
before each attempt, with the same rule as awk (it runs before checkout
and uv), and keeps the sources when the stock security stanza is
missing. ci-runtime.py starts the runtime delta at the runner's mirror,
and its timeout retry fetches the index from the next one. The security
pocket keeps security.ubuntu.com. docs/ci-tooling.md describes it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vpacher
vpacher requested a review from zackees as a code owner November 23, 2026 13:13
@vpacher
vpacher enabled auto-merge November 23, 2026 13:14
@vpacher
vpacher added this pull request to the merge queue Nov 23, 2026
Merged via the queue into master with commit 987d67a Nov 23, 2026
45 checks passed
@vpacher
vpacher deleted the fix/5510-container-apt-mirrors branch November 23, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ci: Tier 2 Linux container jobs fetch from one Ubuntu mirror only; reuse the host apt mirror list as a fallback

1 participant