Skip to content

MINOR: Fix prepare_docker_official_image_source.py leaking the ARG default into the ENV value - #23563

Merged
chia7712 merged 1 commit into
apache:trunkfrom
mingyen066:fix-prepare-docker-official-image-source
Sep 23, 2026
Merged

chia7712 merged 1 commit into
apache:trunkfrom
mingyen066:fix-prepare-docker-official-image-source

Conversation

@mingyen066

@mingyen066 mingyen066 commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Since #22054 and #23263 the jvm Dockerfile declares ARG kafka_url="",
but prepare_docker_official_image_source.py only replaces the ARG kafka_url prefix, so the generated Docker Official Image source ends up
with

ENV kafka_url https://archive.apache.org/.../kafka_2.13-4.1.0.tgz=""

and docker_official_image_build_test.py fails with a 404 from wget.

Changes:

  • Replace the whole ARG <name>[=<default>] line with ENV <name> <value> using a line-anchored regex, so any default value is dropped.
  • Fail the script if an expected ARG line is missing instead of
    silently generating a broken Dockerfile.

To verify, from docker/:

python3 prepare_docker_official_image_source.py -type jvm -v 4.1.0
python3 docker_official_image_build_test.py kafka/test \
    --image-tag=4.1.0 --kafka-version=4.1.0 -b

On trunk the build fails in the first RUN step with wget ... ERROR 404: Not Found; with this PR it completes.

Reviewers: Chia-Ping Tsai chia7712@gmail.com, Maros Orsak maros.orsak159@gmail.com

@github-actions github-actions Bot added triage PRs from the community docker Official Docker image small Small PRs labels Sep 23, 2026
…fault into the ENV value

Since apache#22054 and apache#23263 the jvm Dockerfile declares `ARG kafka_url=""`, but `prepare_docker_official_image_source.py` only replaces the `ARG kafka_url` prefix, so the generated Docker Official Image source ends up with

    ENV kafka_url https://archive.apache.org/dist/kafka/4.1.0/kafka_2.13-4.1.0.tgz=""

and `docker_official_image_build_test.py` fails with a 404 from wget.

Changes:
- Replace the whole `ARG <name>[=<default>]` line with `ENV <name> <value>` using a line-anchored regex, so any default value is dropped.
- Fail the script if an expected `ARG` line is missing instead of silently generating a broken Dockerfile.
@mingyen066
mingyen066 force-pushed the fix-prepare-docker-official-image-source branch from 6aa53ad to 026b978 Compare September 23, 2026 10:10

@chia7712 chia7712 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@see-quick see-quick left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM 👍 Thanks!

@chia7712
chia7712 merged commit 24aac0c into apache:trunk Sep 23, 2026
23 checks passed
chia7712 pushed a commit that referenced this pull request Sep 23, 2026
…fault into the ENV value (#23563)

Since #22054 and #23263 the jvm Dockerfile declares `ARG kafka_url=""`,
but `prepare_docker_official_image_source.py` only replaces the `ARG
kafka_url` prefix, so the generated Docker Official Image source ends up
with

```
ENV kafka_url https://archive.apache.org/.../kafka_2.13-4.1.0.tgz=""
```

and `docker_official_image_build_test.py` fails with a 404 from wget.

Changes:
- Replace the whole `ARG <name>[=<default>]` line with `ENV <name>
<value>` using a line-anchored regex, so any default value is dropped.
- Fail the script if an expected `ARG` line is missing instead of
silently generating a broken Dockerfile.

To verify, from `docker/`:

```bash
python3 prepare_docker_official_image_source.py -type jvm -v 4.1.0
python3 docker_official_image_build_test.py kafka/test \
    --image-tag=4.1.0 --kafka-version=4.1.0 -b
```

On trunk the build fails in the first RUN step with `wget ... ERROR 404:
Not Found`; with this PR it completes.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Maros Orsak
<maros.orsak159@gmail.com>
@github-actions github-actions Bot removed the triage PRs from the community label Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Official Docker image small Small PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants