Repository navigation
Make previous-release package downloads resilient to infrastructure flakes - #107916
Merged
Merged
Conversation
The Upgrade check downloads the previous stable release `.deb` packages during setup. A transient hiccup that exhausted the small retry budget there (5 attempts, ~45s of total backoff) used to abort the whole job in the setup phase before the actual test ran, and was recorded only as a generic `Download script exit code` with an `OK` status - making it hard to attribute as infrastructure noise. Improve `download_build_with_progress`: - accept a configurable `retries` count; - cap the exponential backoff (`DOWNLOAD_RETRY_MAX_BACKOFF`) so raising the retry count extends the total retry window instead of exploding the per-attempt sleep; - fail fast on a genuine `404` (the artifact was never uploaded) instead of burning the whole retry budget; - treat a truncated response (short read vs. `content-length`) as a transient failure rather than producing a corrupt file that only surfaces much later as an opaque `dpkg` error; - log the HTTP status / error and attempt number on each retry. In `download_packages` (`download_release_packages`): - retry the release packages more persistently (`RELEASE_PACKAGE_DOWNLOAD_RETRIES`); - stop silently skipping a missing essential package (the ones `install_packages` installs) - raise a clear, attributable error that distinguishes a genuine `404` from a transient failure, while still tolerating a hiccup on unused extra assets such as `clickhouse-keeper`. Add unit tests for both. #102817 (comment) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [13f7ec4] Summary: ✅ AI ReviewSummaryThis PR makes previous-release package downloads in Upgrade CI more resilient and fail-closed: Final VerdictStatus: ✅ Approve |
maxknv
approved these changes
Jun 19, 2026
Address review (#107916): `download_packages` only flagged required packages that were present in `release.assets` and then failed to download. A partially published release could expose `clickhouse-common-static_..._amd64.deb` (enough for `get_previous_release_tag` to select the tag) while still lacking `clickhouse-client_..._amd64.deb`; the missing asset never entered the download loop, so the function returned success and the job later died with an opaque `dpkg` glob error inside `install_packages`. Now `download_packages` also validates that every required prefix has a matching `_amd64.deb` asset and folds both failure modes (failed download and absent asset) into a single attributable `DownloadException`. The debug-symbols package is made required only in debug mode, since that is the only mode that downloads and installs it. Adds `test_missing_required_package_raises` (a partially published release missing `clickhouse-client_`) and `test_missing_dbg_is_required_only_in_debug_mode`. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`download_release_packages` now exits nonzero when a required previous-release package is missing or fails to download, but the only shell caller, `tests/docker_scripts/upgrade_runner.sh`, ran it inside an `&& ... || ...` list, so `set -e` did not stop on the nonzero status. The follow-up guard only checked `clickhouse-common-static_*.deb` and `clickhouse-server_*.deb`, so a missing `clickhouse-client_..._amd64.deb` or `clickhouse-common-static-dbg_..._amd64.deb` could still slip through to `install_packages` and die there with an opaque `dpkg` glob error - exactly the failure mode this PR set out to make clear and attributable. Handle the download exit code explicitly: on failure, record the `FAIL` row, write a `failure` status to `check_status.tsv`, and `exit 1` before `install_packages` can run; on success, record the `OK` row and continue. Add `ci/tests/test_upgrade_runner_download_boundary.py`, which extracts the real download block from the runner (between stable anchor comments) and runs it under bash with a stub `download_release_packages`, proving a failed download stops before `install_packages` is reached and a successful one proceeds. Extracting the live block keeps the test from drifting from the script it guards. Addresses review feedback: #107916 (comment) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Closed
JonSnow1807
pushed a commit
to JonSnow1807/ClickHouse
that referenced
this pull request
Nov 8, 2026
…ase debs
`download_release_packages.py` downloaded every previous-release deb from
the GitHub release only. On 2026-11-08 github.com answered 504/502/read
timeouts for about two hours ("Increase in timeouts for some
unauthenticated users"), longer than the 10-retry window from ClickHouse#107916
(6-10 min per file), and `Upgrade check (amd_release)` failed with
`Download script failed` on 10 unrelated PRs.
The same files are published to the ClickHouse Debian pool
(https://packages.clickhouse.com/deb/pool/main/c/clickhouse/<asset name>);
for v26.10.2.103 all six amd64 debs there have the GitHub asset size and
sha256. A version that is not in the pool yet (about 30 minutes after a
release) answers a real 404, so the existing 404 fast-fail applies.
Each package now gets the pool as a second source. After GitHub has
failed one package, the rest of the run tries the pool first, so an
outage costs one retry window per job rather than one per package. Once
a required package cannot be obtained from either source the loop stops,
since the job fails anyway. GitHub stays the first source, so a healthy
run makes the same requests as before.
Validated locally with a stub that returns 504 for every GitHub URL:
master fails with the CI message; this change downloads all six debs from
the real pool with matching digests and contacts GitHub only for the
first package. No test is committed (test infrastructure).
Co-Authored-By: Claude Opus 5.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.
The Upgrade check downloads the previous stable release
.debpackages during the setup phase. A transient hiccup that exhausted the small retry budget there (5 attempts, ~45s of total backoff) used to abort the whole job before the actual test ran, and was recorded only as a genericDownload script exit coderow with anOKstatus — making it hard to recognize as infrastructure noise.Reported here: #102817 (comment) (job log: https://github.com/ClickHouse/ClickHouse/actions/runs/27117485031/job/80044635535).
This makes the package download path resilient and self-diagnosing.
download_build_with_progress:retriescount;DOWNLOAD_RETRY_MAX_BACKOFF), so raising the retry count extends the total retry window instead of exploding the per-attempt sleep;404(the artifact was never uploaded) instead of burning the whole retry budget;content-length) as a transient failure rather than producing a corrupt file that only surfaces later as an opaquedpkgerror;download_packages(download_release_packages):RELEASE_PACKAGE_DOWNLOAD_RETRIES);install_packagesinstalls) — raise a clear, attributable error that distinguishes a genuine404from a transient failure, while still tolerating a hiccup on unused extra assets such asclickhouse-keeper.Unit tests added in
ci/tests/.Related: #102817
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required (CI improvement).
🤖 Generated with Claude Code
Version info
26.6.1.1057