Skip to content

Add wget retry logic to Alpine Docker image build - #100380

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-docker-alpine-wget-retry
Mar 22, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-docker-alpine-wget-retry

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Mar 22, 2026 •

Copy link
Copy Markdown
Member

The clickhouse/clickhouse-server:head-alpine-arm64 Docker image build fails intermittently with wget: bad address DNS resolution errors during cross-architecture builds via QEMU. BusyBox wget (used in Alpine) has no built-in retry support, so this adds a wget_with_retry wrapper that retries up to 5 times with a 1-second delay.

Observed in #100363

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):

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.134

The `clickhouse/clickhouse-server:head-alpine-arm64` Docker image build
fails intermittently with `wget: bad address` DNS resolution errors
during cross-architecture builds via QEMU. BusyBox `wget` (used in
Alpine) has no built-in retry support, so a `wget_with_retry` wrapper
retries up to 5 times with a 1-second delay.

#100363

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Mar 22, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f941493]

Summary: ✅


AI Review

Summary

This PR adds a wget_with_retry wrapper in docker/server/Dockerfile.alpine to mitigate intermittent DNS resolution exceptions (wget: bad address) seen in Alpine/QEMU cross-architecture image builds. The change is narrowly scoped, preserves existing package verification behavior, and improves CI reliability without altering user-facing server/runtime behavior.

ClickHouse Rules

Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ➖
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅

Final Verdict

  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Mar 22, 2026
@alexey-milovidov alexey-milovidov self-assigned this Mar 22, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Mar 22, 2026
Merged via the queue into master with commit 9e0dd1f Mar 22, 2026
148 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-docker-alpine-wget-retry branch March 22, 2026 20:46
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 22, 2026
alexey-milovidov pushed a commit to Onyx2406/ClickHouse that referenced this pull request May 19, 2026
The `Docker server image` job intermittently fails when fetching the
prebuilt `.deb` packages from `clickhouse-builds.s3.amazonaws.com`:

```
ERROR 500: Internal Server Error.
ERROR 503: Service Unavailable.
```

Three unrelated PRs hit this S3 download flake over three days
(`ClickHouse#100173` on 2026-05-15 with `500`, `ClickHouse#104694` on 2026-05-14 with `503`,
`ClickHouse#104853` on 2026-05-13 with `503`). On master in the last 14 days the
master `Docker server image` job has 1 failure of the same shape.

`docker/server/Dockerfile.alpine` already wraps `wget` with a retry
helper (added in ClickHouse#100380 to absorb the same kind of transient errors
during Alpine cross-architecture builds via QEMU). The Ubuntu and
distroless flavours still call `wget ... || exit 1` on the very first
attempt, so a single `500`/`503` from S3 kills the whole build.

This change ports the same `wget_with_retry` wrapper to
`docker/server/Dockerfile.ubuntu` and `docker/server/Dockerfile.distroless`
for the `DIRECT_DOWNLOAD_URLS` block (the path used by CI). `WGET_RETRIES`
(default `5`) and `WGET_RETRY_DELAY` (default `1s`) match the Alpine
version and remain overridable via `--build-arg`.

CI report (PR ClickHouse#100173, sha 3ceac71): https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100173&sha=3ceac71a43a5fd4fc1a7859937b23e71b8fe42ae&name_0=PR&name_1=Docker%20server%20image

Co-Authored-By: Claude Opus 4.7 <[email protected]>
pull Bot pushed a commit to Spencerx/ClickHouse that referenced this pull request Jun 28, 2026
The `Docker keeper image` job intermittently fails while fetching the
prebuilt packages from `clickhouse-builds.s3.amazonaws.com`. Example
from PR ClickHouse#108573 (`docker/keeper/Dockerfile.distroless`, amd64): the
`clickhouse-common-static` deb downloads fine, then the
`clickhouse-keeper` deb gets

    HTTP request sent, awaiting response... 503 Service Unavailable
    ERROR 503: Service Unavailable.

and the single-shot `wget ... || exit 1` kills the whole build, so the
downstream `docker library image test` then reports `image does not
exist!`.

The server Dockerfiles already wrap `wget` with a retry helper:
`Dockerfile.alpine` since ClickHouse#100380 (tgz path) and `Dockerfile.ubuntu` /
`Dockerfile.distroless` since ClickHouse#105139 (deb path). The Keeper
Dockerfiles were left with the brittle first-attempt `wget`, so a
single 500/503 from S3 fails the build.

This ports the same `wget_with_retry` wrapper to both Keeper files:
- `docker/keeper/Dockerfile.distroless` deb path (`DIRECT_DOWNLOAD_URLS`),
  mirroring `docker/server/Dockerfile.distroless`.
- `docker/keeper/Dockerfile` tgz path (`DIRECT_DOWNLOAD_URLS` and the
  repository fallback), mirroring `docker/server/Dockerfile.alpine`.

`WGET_RETRIES` (default 5) and `WGET_RETRY_DELAY` (default 1s) match the
server Dockerfiles and stay overridable via `--build-arg`. A persistent
error still fails the build after the retries are exhausted.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
The `Docker keeper image` job intermittently fails while fetching the
prebuilt packages from `clickhouse-builds.s3.amazonaws.com`. Example
from PR ClickHouse#108573 (`docker/keeper/Dockerfile.distroless`, amd64): the
`clickhouse-common-static` deb downloads fine, then the
`clickhouse-keeper` deb gets

    HTTP request sent, awaiting response... 503 Service Unavailable
    ERROR 503: Service Unavailable.

and the single-shot `wget ... || exit 1` kills the whole build, so the
downstream `docker library image test` then reports `image does not
exist!`.

The server Dockerfiles already wrap `wget` with a retry helper:
`Dockerfile.alpine` since ClickHouse#100380 (tgz path) and `Dockerfile.ubuntu` /
`Dockerfile.distroless` since ClickHouse#105139 (deb path). The Keeper
Dockerfiles were left with the brittle first-attempt `wget`, so a
single 500/503 from S3 fails the build.

This ports the same `wget_with_retry` wrapper to both Keeper files:
- `docker/keeper/Dockerfile.distroless` deb path (`DIRECT_DOWNLOAD_URLS`),
  mirroring `docker/server/Dockerfile.distroless`.
- `docker/keeper/Dockerfile` tgz path (`DIRECT_DOWNLOAD_URLS` and the
  repository fallback), mirroring `docker/server/Dockerfile.alpine`.

`WGET_RETRIES` (default 5) and `WGET_RETRY_DELAY` (default 1s) match the
server Dockerfiles and stay overridable via `--build-arg`. A persistent
error still fails the build after the retries are exhausted.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants