Skip to content

Rebuild against Canonical when the in-region apt mirror serves a partial index - #118213

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix/docker-apt-mirror-broken-index
Sep 5, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix/docker-apt-mirror-broken-index

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Sep 5, 2026 •

Copy link
Copy Markdown
Member

Related: #115726
Related: #117960

The Docker keeper image job reded on every arm64 build across the fleet on 2026-09-05 (10 of 10 PRs at 00:00 UTC, again at 04:00 UTC) and on an amd64 build on 2026-09-04, and none of them rebuilt against Canonical although the apt mirror fallback from #115726 is in place.

The in-region mirror answered 503 for the jammy, jammy-updates and jammy-security InRelease files. apt-get update treats that as a warning (W: Failed to fetch ..., W: Some index files failed to download) and carries on with the one suite it did get, so it exits 0 and the E: lands on the apt-get install that follows, as E: Package 'ca-certificates' has no installation candidate or E: Unable to correct problems, you have held broken packages (wget : Depends: libpsl5 ... but it is not installable). is_apt_mirror_failure did not know either shape, so should_try_next_mirror said no and the job failed on the first mirror.

This adds the two signatures to APT_MIRROR_ERRORS. The two guards from the original fallback stay in force: only apt E: lines inside the terminal buildx failure block count, so a recovered apt-get update warning, a step header naming apt, or a truncated log without the fenced shape still does not trigger a rebuild. On the pristine base image these Dockerfiles start from, a package Ubuntu ships that has no candidate or unmet dependencies can only mean the index apt resolved against is a partial one.

Verified with a throwaway test against the real logs of two failed builds from CIDB: master's classifier says no for both, the patched one says yes, and the negative cases (recovered warnings with a later wget failure, signature only in the step header, E: in an earlier successful step, no terminal block) still say no.

Example failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117960&sha=e523443dea969b125df53bdba9f23e04c37cc19b&name_0=PR&name_1=Docker%20keeper%20image

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...


Workflow [PR]
Sync PR [sync-upstream/pr/118213]

Version info

  • Backported to: 26.8.3.47

…ial index

When the in-region mirror withholds a suite's `InRelease` (a `503` for `jammy`,
`jammy-updates` and `jammy-security` on 2026-09-05), `apt-get update` only
warns and carries on with the suites it did get, so the failure surfaces on
`apt-get install` as `E: Package 'ca-certificates' has no installation
candidate` or `E: Unable to correct problems, you have held broken packages`.
`is_apt_mirror_failure` did not know either shape, so every arm64 keeper image
build on the fleet reded without ever trying Canonical.

Both lines are still required to be apt `E:` output inside the terminal buildx
failure block, so a recovered `apt-get update` warning or a step header naming
apt still does not trigger a rebuild.

Example: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117960&sha=e523443dea969b125df53bdba9f23e04c37cc19b&name_0=PR&name_1=Docker%20keeper%20image
(PR: #117960)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ef376f2]

Summary: ✅


AI Review

Summary

This PR broadens APT_MIRROR_ERRORS so a partial Ubuntu index that only surfaces on the later apt-get install path still falls through to the Canonical retry. The direction looks correct, but I do not think it should merge without committed regression coverage for this new log shape.

Findings

⚠️ Majors

  • [ci/jobs/docker_server.py:287-299] The contract here is "a partial Ubuntu index triggers should_try_next_mirror", but this change still proves that only in the PR description. terminal_build_failure / is_apt_mirror_failure already broke once when buildx reworded its output, and extending the same string-matching parser again without a committed ci/tests case means the next output drift will silently take us back to first-mirror failures across the fleet. Suggested fix: land the throwaway reproducer as a focused parser test with one captured failing block that must make should_try_next_mirror return True for the W: Failed to fetch ... plus E: Unable to correct problems, you have held broken packages shape, and one negative sample where the same warning appears in an earlier successful step.
Final Verdict

⚠️ Changes look directionally correct, but I would not merge this without a focused regression test for the new apt failure shape.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 5, 2026
Comment thread ci/jobs/docker_server.py
# resolved against is a partial one, i.e. the mirror. Measured on 2026-09-05,
# when every arm64 keeper image build on the fleet reded this way and no build
# ever reached Canonical.
"has no installation candidate",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contract here is "a partial Ubuntu index rebuilds against Canonical", but this patch still leaves that behavior proven only by the PR description. terminal_build_failure / is_apt_mirror_failure already regressed once when buildx changed its wording, and this change extends the same string-matching parser without any committed ci/tests coverage, so the next output drift will silently take us back to failing on the first mirror.

Please land the throwaway reproducer as a focused parser test: one captured failing block where should_try_next_mirror must return True for the W: Failed to fetch ... plus E: Unable to correct problems, you have held broken packages shape, and one negative sample where the same warning appears in an earlier successful step but the terminal failure is unrelated.

@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Sep 5, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexey-milovidov alexey-milovidov self-assigned this Sep 5, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 5, 2026
Merged via the queue into master with commit 821dd0b Sep 5, 2026
174 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix/docker-apt-mirror-broken-index branch September 5, 2026 12:59
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 5, 2026
pull Bot pushed a commit to sonvt1710/ClickHouse that referenced this pull request Sep 5, 2026
The two signatures added in ClickHouse#118213
were justified by what the base image contains: on a pristine `ubuntu:22.04`, a
package Ubuntu ships that has no installation candidate or unmet dependencies can
only be resolving against a partial index. That inference holds, but it does not
cover the third shape apt produces. Which of the three it picks depends only on
what the missing suites were providing: `busybox`, `ca-certificates` and `locales`
come out as `has no installation candidate` because `/var/lib/dpkg/status` still
names them, a `wget` whose `libpsl5` has gone comes out as `Unable to correct
problems, you have held broken packages`, and `wget` and `tzdata` with nothing left
to refer to them come out as the one shape that was missing, `Unable to locate
package`. Two of the ten image builds that reded on 2026-09-05 after 05:00 UTC were
that third shape, so they still did not reach Canonical.

`Unable to locate package` is also, unlike the other two, exactly what a misspelled
package name in one of these Dockerfiles produces, so adding it to
`APT_MIRROR_ERRORS` would have cost the fail-fast property that the narrowed retry
allowlist of ClickHouse#108969 exists to keep.

There is no need to infer any of this. `apt-get update` says so itself, in the very
same step: `W: Some index files failed to download`, printed once it has warned
about each suite the mirror withheld. Against a healthy mirror it refreshes every
suite silently, so that line is the mirror's own signature, and a genuine packaging
error - whose `apt-get update` was clean - carries none of it. `is_apt_index_failure`
requires both halves, and both from the step the build stopped on: the resolution
error inside the terminal fenced block, and the warning among the same step's
`#N `-prefixed output above it, which is the only thing tying the two together once
buildx has fenced the tail. All three shapes then move behind that evidence, so this
commit widens the coverage and narrows the licence at the same time.

Verified with a throwaway test against the real logs of all twelve failed builds
from CIDB: master says yes for ten of them and this commit for all twelve. Eight
negative cases still say no - a misspelled package in each of the three shapes, an
index warning belonging to an earlier successful step, the signature only in the
fenced step header, a truncated log with no terminal block, a non-apt failure, and
a recovered warning followed by a genuine `dpkg` error in the same step.

Example failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=dab9efce85ab16d6811013d2e2d03ad8245f398f&name_0=MasterCI&name_1=Docker%20server%20image
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Sep 5, 2026
clickhouse-gh Bot pushed a commit that referenced this pull request Sep 5, 2026
clickhouse-gh Bot added a commit that referenced this pull request Sep 5, 2026
Backport #118213 to 26.8: Rebuild against Canonical when the in-region apt mirror serves a partial index
@robot-clickhouse robot-clickhouse added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-ci pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v26.3-must-backport v26.6-must-backport v26.7-must-backport v26.8-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants