fix(template): retry apt fetches via apt.conf to survive mirror flakes#2562
fix(template): retry apt fetches via apt.conf to survive mirror flakes#2562ValentaTomas wants to merge 1 commit into
Conversation
archive.ubuntu.com periodically blackholes connections from CI runners, hanging provision.sh and every downstream template build (smoketest, egress-firewall integration tests) on a 300s/20m timeout. Drop a small 80-retries apt.conf snippet so apt retries 10x with bounded timeouts; config also persists in the rootfs so user RUN apt-get steps benefit.
PR SummaryLow Risk Overview Issues: Reviewed by Cursor Bugbot for commit 8503cb4. Bugbot is set up for automated code reviews on this repo. Configure here. |
❌ 77 Tests Failed:
View the full list of 77 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 8503cb4. Configure here.
| Acquire::Retries "10"; | ||
| Acquire::http::Timeout "30"; | ||
| Acquire::https::Timeout "30"; | ||
| EOF |
There was a problem hiding this comment.
Retry config only written when packages are missing
Medium Severity
The /etc/apt/apt.conf.d/80-retries file is created inside the if [ -n "$MISSING" ] block, so it's only written when there are packages to install. The comment says "Bake retry config into the image so user RUN apt-get steps… survive transient mirror flakiness," but if all required packages are already installed, the config file is never created and customer template RUN apt-get commands won't get retry protection.
Reviewed by Cursor Bugbot for commit 8503cb4. Configure here.
| # Bake retry config into the image so user RUN apt-get steps and | ||
| # provision.sh both survive transient mirror flakiness. | ||
| mkdir -p /etc/apt/apt.conf.d | ||
| cat >/etc/apt/apt.conf.d/80-retries <<'EOF' | ||
| Acquire::Retries "10"; | ||
| Acquire::http::Timeout "30"; | ||
| Acquire::https::Timeout "30"; | ||
| EOF |
There was a problem hiding this comment.
The retry configuration is only created when missing packages are detected. This prevents the configuration from being baked into the image if all required packages are already present, which contradicts the goal of ensuring subsequent user-defined build steps benefit from these retries. Move the configuration creation and the directory initialization outside the conditional block to ensure they are always applied to the image.


What
Drops a small
/etc/apt/apt.conf.d/80-retriessnippet insideprovision.sh(Ubuntu base templates) so apt retries 10x with bounded timeouts.Same snippet added to
tests/e2b.Dockerfile.Why
archive.ubuntu.comperiodically blackholes connections from GHA runners (e.g.91.189.91.81,91.189.92.23,185.125.190.81...). Without retries,provision.sh's singleapt-get updateblocks the whole template build until the 300 s API or 20 min smoketest timeout fires, cascading into ~80 integration test failures (TestEgressFirewall*,TestTemplateBuildRUN,TestSmokeAllFCVersions, ...). Same outage takes downmain's periodic test runs too.Retries are written before
apt-get update, and because the file lives in/etc/apt/apt.conf.d/, they apply to userRUN apt-getsteps in customer templates as well.