Repository navigation
Fix the apt mirror fallback for the Docker image jobs never running - #116444
Merged
Merged
Conversation
`Docker server image` and `Docker keeper image` kept going red on master
whenever `us-east-1.ec2.ports.ubuntu.com` answered `503`. Only the arm64 tags
failed, because arm64 fetches its `.deb` packages from `ports.ubuntu.com` while
amd64 uses `archive.ubuntu.com`:
E: Failed to fetch http://us-east-1.ec2.ports.ubuntu.com/ubuntu-ports/pool/main/o/openssl/openssl_3.0.2-0ubuntu1.29_arm64.deb 503 Service Unavailable
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
`ci/jobs/docker_server.py` already carries the remedy for exactly this - rebuild
the image against Canonical's mirror once the retries against the in-region one
are used up - but it never ran. `terminal_build_failure` identifies the step the
build stopped on by scanning for `buildx`'s top-level error, matching the literal
`ERROR: failed to solve:`. `buildx` 0.23 reworded that line to `ERROR: failed to
build: failed to solve:` (measured on 0.30.1), so no terminal step was ever
found, `is_apt_mirror_failure` answered "not the mirror" for every failure, and
the fallback was dead code from the day it was added.
Anchor the match on the two parts that did not move instead - a line that starts
with `ERROR: ` and names the solve step - so a future infix cannot break it
again. Replaying the failing job's own log through the classifier now returns
"try the next mirror", where master returns "no".
Two adjacent errors, found while checking the classifier against real `docker
buildx` output rather than a canned string: the matched region ran past the
closing fence into the `Dockerfile` source that `buildx` echoes after it, and it
included the step header inside the fence, which repeats the `RUN` command. Both
are recipe text rather than build output, so a `RUN` line that merely names apt
could decide the verdict; the block now ends at the closing fence and the header
line is skipped. The fail-closed path is also logged now - being silent is what
kept this from being noticed.
`ports.ubuntu.com` answers `200` from an AWS host while
`us-east-1.ec2.ports.ubuntu.com` answers `503`, so the restored fallback does
rescue these builds.
Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=887b93e16db98a72906f035e47af9b2ffbf58aa2&name_0=MasterCI&name_1=Docker%20server%20image
Failed checks on master: https://play.clickhouse.com/play?user=play&tab=Failed%20checks
Contributor
|
Workflow [PR], commit [deaccc6] Summary: ✅ AI ReviewSummaryThis PR repairs the Missing context / blind spots
Final Verdict
|
Naz-Ovh
pushed a commit
to 0x-fork/ClickHouse
that referenced
this pull request
Sep 13, 2026
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #115726
Docker server imageandDocker keeper imagekeep going red on master wheneverus-east-1.ec2.ports.ubuntu.comanswers503. Only the arm64 tags fail, because arm64 fetches its.debpackages fromports.ubuntu.comwhile amd64 usesarchive.ubuntu.com:ci/jobs/docker_server.pyalready carries the remedy for exactly this — added in #115726, it rebuilds the image against Canonical's mirror once the retries against the in-region one are used up — but it never ran.terminal_build_failureidentifies the step the build stopped on by scanning forbuildx's top-level error, matching the literalERROR: failed to solve:.buildx0.23 reworded that line toERROR: failed to build: failed to solve:(measured on 0.30.1), so no terminal step was ever found,is_apt_mirror_failureanswered "not the mirror" for every failure, and the fallback was dead code from the day it was added.This anchors the match on the two parts that did not move — a line that starts with
ERROR:and names the solve step — so a future infix cannot break it again. Replaying the failing job's own log through the classifier now returns "try the next mirror", where master returns "no".Two adjacent errors turned up while checking the classifier against real
docker buildxoutput rather than a canned string: the matched region ran past the closing fence into theDockerfilesource thatbuildxechoes after it, and it included the step header inside the fence, which repeats theRUNcommand. Both are recipe text rather than build output, so aRUNline that merely names apt could decide the verdict; the block now ends at the closing fence and the header line is skipped. The fail-closed path is logged now too — being silent is what kept this from being noticed.The fallback is a working remedy:
ports.ubuntu.comanswers200from an AWS host whileus-east-1.ec2.ports.ubuntu.comanswers503, and building the failing step forlinux/arm64against Canonical fetches at 12.7 MB/s and succeeds.The updated test fails 5 of its arms against master and passes against this change;
ci/tests/test_docker_apt_mirror_fallback.pyandci/tests/test_docker_buildx_timeout.pyare green (31 passed).Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=887b93e16db98a72906f035e47af9b2ffbf58aa2&name_0=MasterCI&name_1=Docker%20server%20image
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Workflow [PR]
Sync PR [sync-upstream/pr/116444]