Repository navigation
Fail image builds at the apt index fetch so the apt mirror fallback can fire - #118023
Conversation
…an fire `apt-get update` does not treat a failed repository index fetch as fatal: it reports the failure at `W:` severity, exits 0, and proceeds with a stale or absent index. The `RUN` chain therefore continues into `apt-get install`, which resolves against an index that was never refreshed and dies at `E:` severity with `E: Unable to correct problems, you have held broken packages`, preceded by `wget : Depends: libpsl5 (>= 0.16.0) but it is not installable`. Everything downstream then behaves correctly on the evidence it is handed. buildx fences the tail of the failing step, which by then holds only the resolution error; `terminal_build_failure` returns that fence; `is_apt_mirror_failure` finds no `APT_MIRROR_ERRORS` token at `E:` severity, because the lines that do carry those tokens are `W:` and sit above the fence; `should_try_next_mirror` returns False and the mirror loop exits without ever rebuilding against Canonical. The Canonical fallback is therefore handed exactly the evidence it is designed to reject, on the outage it exists for. `--error-on=any` promotes those lines to `E:` and stops the chain before the install runs, which is the shape the merged classifier was written to recognise. Nothing in `ci/` changes. Measured in `ubuntu:22.04` (apt 2.4.14), against a local 503 server and against a refused port: failure shape apt-get update rc severity of the mirror lines 503 on InRelease plain 0 W: 503 on InRelease --error-on=any 100 E: connection refused plain 0 W: connection refused --error-on=any 100 E: `any` is apt's only accepted value; `no`, `some` and `warn` each return `E: Unknown update error mode`. End to end, with each captured buildx output fed to the shipped `should_try_next_mirror`: docker/server/Dockerfile.distroless 503 False -> True docker/keeper/Dockerfile.distroless 503 False -> True docker/server/Dockerfile.ubuntu 503 False -> True docker/server/Dockerfile.distroless connection refused False -> True The pristine tree reproduces the CI failure byte-for-byte: same failure point (`Dockerfile.distroless:31`), same `exit code: 100`, same unmet dependency, same terminal error. Both arms still fail the build, so this changes the classification, not the outcome of a broken mirror. Control: a full `ch-builder` build against the real mirrors still succeeds with rc 0 and zero `E:` lines, exercising all three flagged sites including the `packages.clickhouse.com` refresh. The repository already documents this defect on the sibling package manager, in `docker/server/Dockerfile.alpine` and `docker/keeper/Dockerfile`: "`apk` has no retry option, and it does not treat a failed repository index fetch as fatal: it proceeds with an empty index, so every requested package is then reported as `no such package`". apt behaves the same way and, unlike apk, has an option for it. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117612&sha=641c9b6831e3c49cc505ac66eed049c46b1f4a4d&name_0=PR&name_1=Docker%20server%20image Related: ClickHouse#117612 Related: ClickHouse#116444 Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: 0 blockers, 0 majorsIndependent cold review plus a second-model pass over the whole diff: no blockers, no majors, The one question worth recording, because getting it wrong would be silent: the comment sits Also verified: all nine Noted, not blocking: nothing mechanically stops a future |
|
Workflow [PR], commit [e63dae6] Summary: ✅ AI ReviewSummaryThis PR makes the Ubuntu-based image builds fail at Findings
Final VerdictStatus: Minimum required action: prevent the final refresh after |
|
cc @Felixoid, could you review this? |
| && echo "${REPOSITORY}" > /etc/apt/sources.list.d/clickhouse.list \ | ||
| && echo "installing from repository: ${REPOSITORY}" \ | ||
| && apt-get update \ | ||
| && apt-get update --error-on=any \ |
There was a problem hiding this comment.
This makes the retry signal too broad on the final refresh after clickhouse.list is written. ci/jobs/docker_server.py only changes apt_archive / apt_ports_archive, but is_apt_mirror_failure matches any fenced E: Failed to fetch / E: Some index files failed to download without checking which source failed.
I traced that against the current parser with a buildx failure where only https://packages.clickhouse.com/deb is unreachable, and both is_apt_mirror_failure and should_try_next_mirror return True. So a packages.clickhouse.com outage now burns a full rebuild against the next Ubuntu mirror even though the retried inputs for the failing source are identical.
Can we either scope the retry classifier to the Ubuntu mirror hosts, or avoid turning this post-clickhouse.list apt-get update into the same generic mirror-failure shape?
There was a problem hiding this comment.
Confirmed at the parser level: the flag does change the classification at that site. Local A/B against the shipped should_try_next_mirror, with the ClickHouse repository answering 503 and the Ubuntu mirror healthy:
apt-get update at line 136 |
terminal E: inside the fence |
should_try_next_mirror |
|---|---|---|
| plain | E: Unable to locate package clickhouse-client |
False |
--error-on=any |
E: Failed to fetch .../dists/stable/InRelease 503 plus E: Some index files failed to download |
True |
I am keeping the flag there, for three measured reasons.
-
This
RUNdoes not execute in the job that owns the classifier. CI installs the packages before it (DIRECT_DOWNLOAD_URLS, ordeb_location_url), soclickhouse local -q 'SELECT 1' && exit 0short-circuits the whole chain. In the latest greenDocker server imagerun, all four image builds report this step asDONE 0.2s/5.8s/0.2s/5.4swith zero output lines; every apt fetch line in that job belongs to the base-layersed ... && apt-get updatestep, whose only sources are the Ubuntu mirror; and no output line mentionspackages.clickhouse.comat all: https://s3.amazonaws.com/clickhouse-test-reports/PRs/118005/013d57537a1cdfc163d0020d043587c8afcca3ef/pr/docker_server_image/job.log . In the one path where thisRUNcould execute,buildx_argsalso pointsREPOSITORYat the build's own bucket rather thanpackages.clickhouse.com. -
The host-blindness predates this change, so scoping is not a fix for this diff.
docker_server.pydoes no URL parsing anywhere (urlparse,netloc,hostname: 0 occurrences), andapt-get installalready emitsE: Failed to fetch <url>plusE: Unable to fetch some archivesfor any host with no flag involved: a real arm64 keeper payload that failed to fetchwget_1.21.2-2ubuntu1.5_arm64.debwith a 503 isTruetoday, and rewriting only its host topackages.clickhouse.comleaves itTrue. Scoping the classifier toapt_archive/apt_ports_archivestands on its own merits as a change to that file. -
Line 136 is inside
#docker-official-library:on(markers at 40 and 110), so it ships in the published Dockerfile, whereREPOSITORYkeeps itspackages.clickhouse.comdefault and thisRUNis the primary install path with no fallback machinery at all. The first row of the table is what that build reports today when the repository 503s, which is precisely the misleading packaging-shaped error this PR removes. Dropping the flag here would keep it.
Residual I am not raising separately: the classifier stays host-blind, so if this RUN ever does execute in CI, one rebuild against the next mirror is spent before the build fails with the accurate error.
ecc450e
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Make a failed apt package index refresh fatal in the server and keeper image builds, so a broken apt mirror is reported as a mirror failure instead of an unsatisfiable dependency.
Description
Docker server imageandDocker keeper imagego red on an apt-mirror outage without everrebuilding against Canonical, even though that fallback is merged and its token defect
(#116444) is fixed on this base.
The producer is the cause, not the classifier.
apt-get updatedoes not treat a failed indexfetch as fatal: it warns, exits 0 and proceeds with a stale or absent index, so the
RUNchaincontinues into
apt-get install, which dies on an unsatisfiable dependency. buildx fences onlythat resolution error, so
is_apt_mirror_failurefinds no mirror token atE:severity andshould_try_next_mirrorreturns False; the lines that do carry the tokens areW:and sitabove the fence.
--error-on=anypromotes them toE:and stops the chain before the install,which is the shape the merged classifier already recognises. Nothing in
ci/changes.Validated per Dockerfile against a local 503 server, both shapes: the pristine tree reproduces
the CI failure byte-for-byte with
should_try_next_mirrorFalse; with the flag it is True.Both arms still fail the build, so this changes the classification, not the outcome. A full
ch-builderbuild against the real mirrors still succeeds, exercising all three sites.Two disclosures. 4 of the 9 sites lie outside the
#docker-official-libraryregion, so thepublished Dockerfiles become strict too, with no fallback behind them; I read that as wanted
for a release image, but say so if you want it confined. And a build that today survives a
transient failure on a stale index will now fail at the fetch, then take the retries and the
Canonical rebuild.
Not changed here: the
ci/docker/sites have the same behaviour and no fallback;26.8stillcarries the pre-#116444
BUILDX_SOLVE_ERROR, which needs av26.8-must-backportlabel on#116444.
No related open issue found. CI report:
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117612&sha=641c9b6831e3c49cc505ac66eed049c46b1f4a4d&name_0=PR&name_1=Docker%20server%20image
Related: #116444
Related: #117578
Workflow [PR]
Sync PR [sync-upstream/pr/118023]
Version info
26.9.1.1364(included in26.9and later)