ci(kafka-loadtest): switch off Ubuntu/Debian base images to avoid apt mirror flakes (#9119)

* ci(kafka-loadtest): retry apt-get to survive Ubuntu mirror flakes

The Kafka Quick Test workflow's Docker build of Dockerfile.loadtest
keeps hitting "Connection failed [IP: ...]" on archive.ubuntu.com /
security.ubuntu.com mid-build, e.g.:

    failed to solve: process "/bin/sh -c apt-get update && \
      apt-get install -y ca-certificates curl jq bash netcat ..."
      did not complete successfully: exit code: 100

Same class of failure PR #9106 fixed for pjdfstest. Apply the same
two retry knobs to Dockerfile.loadtest and Dockerfile.seektest so a
transient mirror flake retries five times with a 30s timeout instead
of failing the whole workflow.

(The fuller pjdfstest fix also restructured the build to use
docker/build-push-action with type=gha cache. Doing that for
kafka-client-loadtest would mean rewriting the make/docker-compose
build path; defer until the apt-retry alone proves insufficient.)

* ci(kafka-loadtest): also drop recommends/suggests + apt-get clean

Address PR review (gemini-code-assist): fully align with PR #9106's
pattern by adding --no-install-recommends / --no-install-suggests so
the runtime images stay small and don't pull in extra packages, plus
apt-get clean before rm -rf /var/lib/apt/lists/* in Dockerfile.seektest.

* ci(kafka-loadtest): use alpine / maven base images instead of apt

The previous rounds of apt-retry / apt-clean knobs aren't enough:
the Ubuntu mirror is persistently unreachable from the GitHub runner
for minutes at a time, which blows past the 5-retry / 30-second
Acquire configuration and still kills the build (see run 24551809614).

Switch both runtime images so no apt fetch is needed at all:

- Dockerfile.loadtest now runs on alpine:3.20. All runtime deps
  (ca-certificates, curl, jq, bash, netcat-openbsd) are in the
  Alpine main repo, fetched from Alpine's CDN rather than the
  Ubuntu archive that keeps going dark.
- Dockerfile.seektest now uses maven:3.9-eclipse-temurin-11, which
  ships JDK 11 and Maven preinstalled — no apt-get maven step.

This also means the runtime images no longer care about
Acquire::Retries / DEBIAN_FRONTEND / apt-get clean, so those lines
are removed with the apt call they were configuring.
This commit is contained in:
Chris Lu
2026-04-17 07:43:19 -07:00
committed by GitHub
parent 45578a42e9
commit f720f559cb
2 changed files with 12 additions and 9 deletions
@@ -17,16 +17,18 @@ COPY test/kafka/kafka-client-loadtest/ ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /kafka-loadtest ./cmd/loadtest
# Stage 2: Runtime
FROM ubuntu:22.04
# Use alpine so we don't depend on Ubuntu apt mirrors, which intermittently
# refuse connections from GitHub Actions runners and fail the CI build.
# All runtime dependencies we need (ca-certificates, curl, jq, bash, nc)
# are in the Alpine main repo.
FROM alpine:3.20
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
RUN apk add --no-cache \
ca-certificates \
curl \
jq \
bash \
netcat \
&& rm -rf /var/lib/apt/lists/*
netcat-openbsd
# Copy built binary from builder stage
COPY --from=builder /kafka-loadtest /usr/local/bin/kafka-loadtest
@@ -1,7 +1,8 @@
FROM openjdk:11-jdk-slim
# Install Maven
RUN apt-get update && apt-get install -y maven && rm -rf /var/lib/apt/lists/*
# Use the official Eclipse Temurin + Maven image so we don't depend on
# Debian apt mirrors, which intermittently refuse connections from
# GitHub Actions runners and fail the CI build. This image already has
# JDK 11 and Maven installed.
FROM maven:3.9-eclipse-temurin-11
WORKDIR /app