chia7712 commented on code in PR #17625: URL: https://github.com/apache/kafka/pull/17625#discussion_r1823063175
########## tests/docker/Dockerfile: ########## @@ -13,10 +13,38 @@ # See the License for the specific language governing permissions and # limitations under the License. -# The base image of openjdk:17 is typically oraclelinux:8-slim, which doesn't include apt-get. -# Therefore, use openjdk:17-buster instead. -ARG jdk_version=openjdk:17-buster -FROM $jdk_version AS build-native-image +# We need to build the differnet versions of Java in same image, because the +# zookeeper client 3.4.x can't run under JDK 17, so we need to use JDK 11 in 2.1 ~ 2.3 +# kafka versions, see KAFKA-17888 +ARG os_version=ubuntu:latest +FROM $os_version AS build-native-image + +ARG jdk_11_version=11.0.2-linux-x64 +ARG jdk_11_url=https://s3-us-west-2.amazonaws.com/kafka-packages/jdk-${jdk_11_version}.tar.gz +ARG jdk_version=17-linux-x64 +ARG jdk_url=https://s3-us-west-2.amazonaws.com/kafka-packages/jdk-${jdk_version}.tar.gz Review Comment: `jdk_17_url` ########## tests/docker/Dockerfile: ########## @@ -13,10 +13,38 @@ # See the License for the specific language governing permissions and # limitations under the License. -# The base image of openjdk:17 is typically oraclelinux:8-slim, which doesn't include apt-get. -# Therefore, use openjdk:17-buster instead. -ARG jdk_version=openjdk:17-buster -FROM $jdk_version AS build-native-image +# We need to build the differnet versions of Java in same image, because the +# zookeeper client 3.4.x can't run under JDK 17, so we need to use JDK 11 in 2.1 ~ 2.3 +# kafka versions, see KAFKA-17888 +ARG os_version=ubuntu:latest +FROM $os_version AS build-native-image + +ARG jdk_11_version=11.0.2-linux-x64 Review Comment: exposing `jdk_11_url` is good enough. Additionally, `https://s3-us-west-2.amazonaws.com/kafka-packages` does not offer all distributions so allowing developers to define `jdk_11_version` is meaningless ########## tests/docker/Dockerfile: ########## @@ -13,10 +13,38 @@ # See the License for the specific language governing permissions and # limitations under the License. -# The base image of openjdk:17 is typically oraclelinux:8-slim, which doesn't include apt-get. -# Therefore, use openjdk:17-buster instead. -ARG jdk_version=openjdk:17-buster -FROM $jdk_version AS build-native-image +# We need to build the differnet versions of Java in same image, because the +# zookeeper client 3.4.x can't run under JDK 17, so we need to use JDK 11 in 2.1 ~ 2.3 +# kafka versions, see KAFKA-17888 +ARG os_version=ubuntu:latest +FROM $os_version AS build-native-image Review Comment: we can use ubuntu in this intermediate image ########## tests/docker/ducker-ak: ########## @@ -346,15 +362,23 @@ ducker_up() { -C|--custom-ducktape) set_once custom_ducktape "${2}" "the custom ducktape directory"; shift 2;; -f|--force) force=1; shift;; -n|--num-nodes) set_once num_nodes "${2}" "number of nodes"; shift 2;; - -j|--jdk) set_once jdk_version "${2}" "the OpenJDK base image"; shift 2;; + -j|--jdk) set_once jdk_version "${2}" "the default JDK version to use"; shift 2;; + -j11|--jdk11) set_once jdk_11_version "${2}" "the default JDK 11 version to use"; shift 2;; + -j11u|--jdk11-url) set_once jdk_11_url "${2}" "the default download JDK 11 url to use"; shift 2;; + -u|--url) set_once jdk_url "${2}" "the default download JDK url to use"; shift 2;; + -o|--os) set_once os_version "${2}" "the default OS version to use"; shift 2;; -e|--expose-ports) set_once expose_ports "${2}" "the ports to expose"; shift 2;; -m|--kafka_mode) set_once kafka_mode "${2}" "the mode in which kafka will run"; shift 2;; *) set_once image_name "${1}" "docker image name"; shift;; esac done [[ -n "${num_nodes}" ]] || num_nodes="${default_num_nodes}" - [[ -n "${jdk_version}" ]] || jdk_version="${default_jdk}" + [[ -n "${jdk_version}" ]] || jdk_version="${default_jdk}" || jdk_url="https://s3-us-west-2.amazonaws.com/kafka-packages/jdk-${default_jdk}.tar.gz" Review Comment: remove the jdk_version ########## tests/docker/Dockerfile: ########## @@ -55,6 +83,20 @@ ENV TZ="/usr/share/zoneinfo/America/Los_Angeles" # Do not ask for confirmations when running apt-get, etc. ENV DEBIAN_FRONTEND noninteractive +ENV java_base_dir=/opt/jdk + +# Copy the JDKs from the build-native-image stage +COPY --from=build-native-image ${java_base_dir}/11 ${java_base_dir}/11 +COPY --from=build-native-image ${java_base_dir}/17 ${java_base_dir}/17 + +# This JAVA_HOME path is also used in tests/kafkatest/services/kafka/util.py, +# so if you change it here, you should also change it there. +ENV JAVA_HOME=${java_base_dir}/17 +ENV PATH="$JAVA_HOME/bin:$PATH" + +# Create symlinks for keytool Review Comment: why we need it? ########## tests/docker/Dockerfile: ########## @@ -13,10 +13,38 @@ # See the License for the specific language governing permissions and # limitations under the License. -# The base image of openjdk:17 is typically oraclelinux:8-slim, which doesn't include apt-get. -# Therefore, use openjdk:17-buster instead. -ARG jdk_version=openjdk:17-buster -FROM $jdk_version AS build-native-image +# We need to build the differnet versions of Java in same image, because the +# zookeeper client 3.4.x can't run under JDK 17, so we need to use JDK 11 in 2.1 ~ 2.3 +# kafka versions, see KAFKA-17888 +ARG os_version=ubuntu:latest +FROM $os_version AS build-native-image + +ARG jdk_11_version=11.0.2-linux-x64 +ARG jdk_11_url=https://s3-us-west-2.amazonaws.com/kafka-packages/jdk-${jdk_11_version}.tar.gz +ARG jdk_version=17-linux-x64 +ARG jdk_url=https://s3-us-west-2.amazonaws.com/kafka-packages/jdk-${jdk_version}.tar.gz + +RUN apt-get update && \ + apt-get install -y curl \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /opt +ENV java_base_dir=/opt/jdk + +RUN curl -L -o ${jdk_11_version}.tar.gz ${jdk_11_url} && \ + mkdir -p ${java_base_dir}/11 && \ + tar -xzf ${jdk_11_version}.tar.gz -C ${java_base_dir}/11 --strip-components=1 && \ + rm ${jdk_11_version}.tar.gz + +RUN curl -L -o ${jdk_version}.tar.gz ${jdk_url} && \ + mkdir -p ${java_base_dir}/17 && \ + tar -xzf ${jdk_version}.tar.gz -C ${java_base_dir}/17 --strip-components=1 && \ + rm ${jdk_version}.tar.gz + +# This JAVA_HOME path is also used in tests/kafkatest/services/kafka/util.py, +# so if you change it here, you should also change it there. +ENV JAVA_HOME=${java_base_dir}/17 Review Comment: we don't need to define it in this intermediate image ########## tests/docker/Dockerfile: ########## @@ -13,10 +13,38 @@ # See the License for the specific language governing permissions and # limitations under the License. -# The base image of openjdk:17 is typically oraclelinux:8-slim, which doesn't include apt-get. -# Therefore, use openjdk:17-buster instead. -ARG jdk_version=openjdk:17-buster -FROM $jdk_version AS build-native-image +# We need to build the differnet versions of Java in same image, because the +# zookeeper client 3.4.x can't run under JDK 17, so we need to use JDK 11 in 2.1 ~ 2.3 +# kafka versions, see KAFKA-17888 +ARG os_version=ubuntu:latest Review Comment: move this arg to next phase ########## tests/docker/Dockerfile: ########## @@ -55,6 +83,20 @@ ENV TZ="/usr/share/zoneinfo/America/Los_Angeles" # Do not ask for confirmations when running apt-get, etc. ENV DEBIAN_FRONTEND noninteractive +ENV java_base_dir=/opt/jdk + +# Copy the JDKs from the build-native-image stage +COPY --from=build-native-image ${java_base_dir}/11 ${java_base_dir}/11 +COPY --from=build-native-image ${java_base_dir}/17 ${java_base_dir}/17 + +# This JAVA_HOME path is also used in tests/kafkatest/services/kafka/util.py, +# so if you change it here, you should also change it there. +ENV JAVA_HOME=${java_base_dir}/17 Review Comment: ``` ENV JAVA_HOME=${java_base_dir}/default ENV PATH="$JAVA_HOME/bin:$PATH" RUN ln -s ${java_base_dir}/17 ${java_base_dir}/default ``` ########## tests/docker/Dockerfile: ########## @@ -13,10 +13,38 @@ # See the License for the specific language governing permissions and # limitations under the License. -# The base image of openjdk:17 is typically oraclelinux:8-slim, which doesn't include apt-get. -# Therefore, use openjdk:17-buster instead. -ARG jdk_version=openjdk:17-buster -FROM $jdk_version AS build-native-image +# We need to build the differnet versions of Java in same image, because the +# zookeeper client 3.4.x can't run under JDK 17, so we need to use JDK 11 in 2.1 ~ 2.3 +# kafka versions, see KAFKA-17888 +ARG os_version=ubuntu:latest +FROM $os_version AS build-native-image + +ARG jdk_11_version=11.0.2-linux-x64 +ARG jdk_11_url=https://s3-us-west-2.amazonaws.com/kafka-packages/jdk-${jdk_11_version}.tar.gz +ARG jdk_version=17-linux-x64 +ARG jdk_url=https://s3-us-west-2.amazonaws.com/kafka-packages/jdk-${jdk_version}.tar.gz + +RUN apt-get update && \ + apt-get install -y curl \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /opt +ENV java_base_dir=/opt/jdk + +RUN curl -L -o ${jdk_11_version}.tar.gz ${jdk_11_url} && \ + mkdir -p ${java_base_dir}/11 && \ + tar -xzf ${jdk_11_version}.tar.gz -C ${java_base_dir}/11 --strip-components=1 && \ + rm ${jdk_11_version}.tar.gz + +RUN curl -L -o ${jdk_version}.tar.gz ${jdk_url} && \ Review Comment: ``` RUN curl -L -o jdk_17.tar.gz ${jdk_url} && \ mkdir -p ${java_base_dir}/17 && \ tar -xzf jdk_17.tar.gz -C ${java_base_dir}/17 --strip-components=1 ``` ########## tests/docker/Dockerfile: ########## @@ -13,10 +13,38 @@ # See the License for the specific language governing permissions and # limitations under the License. -# The base image of openjdk:17 is typically oraclelinux:8-slim, which doesn't include apt-get. -# Therefore, use openjdk:17-buster instead. -ARG jdk_version=openjdk:17-buster -FROM $jdk_version AS build-native-image +# We need to build the differnet versions of Java in same image, because the +# zookeeper client 3.4.x can't run under JDK 17, so we need to use JDK 11 in 2.1 ~ 2.3 +# kafka versions, see KAFKA-17888 +ARG os_version=ubuntu:latest +FROM $os_version AS build-native-image + +ARG jdk_11_version=11.0.2-linux-x64 +ARG jdk_11_url=https://s3-us-west-2.amazonaws.com/kafka-packages/jdk-${jdk_11_version}.tar.gz +ARG jdk_version=17-linux-x64 +ARG jdk_url=https://s3-us-west-2.amazonaws.com/kafka-packages/jdk-${jdk_version}.tar.gz + +RUN apt-get update && \ + apt-get install -y curl \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /opt +ENV java_base_dir=/opt/jdk + +RUN curl -L -o ${jdk_11_version}.tar.gz ${jdk_11_url} && \ Review Comment: ``` RUN curl -L -o jdk_11.tar.gz ${jdk_11_url} && \ mkdir -p ${java_base_dir}/11 && \ tar -xzf jdk_11.tar.gz -C ${java_base_dir}/11 --strip-components=1 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
