From f6a85f831ef4efa8175f6bc3d5c503c79df17a01 Mon Sep 17 00:00:00 2001 From: Dominic Evans Date: Mon, 23 Dec 2024 13:06:02 +0000 Subject: [PATCH] feat(ci): build kafka 4.0 from src for testing Whilst 4.0 isn't yet released, in order to allow us to do some up-front testing, compile from src Signed-off-by: Dominic Evans --- Dockerfile.kafka | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Dockerfile.kafka b/Dockerfile.kafka index bd7ee9851..9d6f0df79 100644 --- a/Dockerfile.kafka +++ b/Dockerfile.kafka @@ -3,7 +3,7 @@ FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5@sha256:daa61d6103e98bccf40d USER root RUN microdnf update -y \ - && microdnf install -y gzip java-17-openjdk-headless tar tzdata-java \ + && microdnf install -y git gzip java-17-openjdk-headless tar tzdata-java \ && microdnf reinstall -y tzdata \ && microdnf clean all @@ -24,7 +24,15 @@ ARG KAFKA_MIRROR="https://s3-us-west-2.amazonaws.com/kafka-packages" SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN mkdir -p "/opt/kafka-${KAFKA_VERSION}" \ && chmod a+rw "/opt/kafka-${KAFKA_VERSION}" \ - && curl -s "$KAFKA_MIRROR/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz" | tar xz --strip-components=1 -C "/opt/kafka-${KAFKA_VERSION}" + && if [ "$KAFKA_VERSION" = "4.0.0" ]; then \ + microdnf install -y java-17-openjdk-devel \ + && git clone --depth=1 --single-branch -b 4.0 https://github.com/apache/kafka /usr/src/kafka \ + && cd /usr/src/kafka && sed -e '/version=/s/-SNAPSHOT//' -i gradle.properties && ./gradlew releaseTarGz -x siteDocsTar -x javadoc \ + && tar xzf core/build/distributions/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz --strip-components=1 -C "/opt/kafka-${KAFKA_VERSION}" \ + && rm -rf /usr/src/kafka ; \ + else \ + curl -s "$KAFKA_MIRROR/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz" | tar xz --strip-components=1 -C "/opt/kafka-${KAFKA_VERSION}" ; \ + fi # older kafka versions depend upon jaxb-api being bundled with the JDK, but it # was removed from Java 11 so work around that by including it in the kafka