Commit 3f0d5c9
authored
ci(apt): harden apt with retries + Azure mirror + archive fallback (#7028)
Transient TCP timeouts to archive.ubuntu.com have intermittently failed
apt installs in both the docker-new base image (during ansible's
`apt install` step) and the self-hosted `setup-universe` GHA job
(running on bare ubuntu:22.04 / ubuntu:24.04 containers). Apply the
same two complementary reliability measures in both places, before the
first apt call so the initial `apt-get update` already benefits.
- `Acquire::Retries "5"` with 30s HTTP(S) timeouts via
`/etc/apt/apt.conf.d/99-retries`. Survives transient TCP flakes;
inherited by every downstream stage in the docker-new graph.
- `mirror+file:///etc/apt/ubuntu-mirrors.list` replacing each
`http://archive.ubuntu.com/ubuntu` reference in
`sources.list` (classic jammy / humble base) and
`sources.list.d/ubuntu.sources` (deb822 noble / jazzy base). The
mirrorlist pins `azure.archive.ubuntu.com` (`priority:1`) as the
primary source and `archive.ubuntu.com` (`priority:2`) as the
failsafe. `priority:` annotations are load-bearing: without them
`apt-transport-mirror` treats peer URLs as equal and spreads
requests across them, which combined with `mirror+file://` can
produce the "File has unexpected size - Mirror sync in progress?"
error when InRelease and Packages.gz come from different mid-sync
hosts. The annotations ensure every request hits azure first.
`security.ubuntu.com` is left untouched (separate host, not mirrored
on Azure). File-existence guard uses `if [ -f "$f" ]; then ...; fi`
rather than `[ -f "$f" ] && sed ...`: under `sh -e` (the default for
GHA `run:` steps) the `&&` chain short-circuits and returns 1 when
the file doesn't exist, tripping errexit. Only one source format is
present on any given Ubuntu version.
Secondary throughput win: GHA runners live inside Azure's network, so
azure.archive.ubuntu.com is an order of magnitude faster than the
public archive.ubuntu.com. Pinning azure as primary turns the mirror
list from a load-balancing pessimization into a first-win config.
Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>1 parent 4589e0d commit 3f0d5c9
2 files changed
Lines changed: 22 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
32 | 44 | | |
33 | 45 | | |
34 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
14 | 23 | | |
15 | 24 | | |
16 | 25 | | |
| |||
0 commit comments