Browse Source

HADOOP-16888. [JDK11] Support JDK11 in the precommit job (#2012)

* Install JDK 11 in the docker image
* Refactor Dockerfile
* Add compile test with JDK11 via Yetus multijdk feature
Akira Ajisaka 4 năm trước cách đây
mục cha
commit
9821b94c94
2 tập tin đã thay đổi với 18 bổ sung40 xóa
  1. 5 0
      Jenkinsfile
  2. 13 40
      dev-support/docker/Dockerfile

+ 5 - 0
Jenkinsfile

@@ -154,6 +154,11 @@ pipeline {
                         # use emoji vote so it is easier to find the broken line
                         # use emoji vote so it is easier to find the broken line
                         YETUS_ARGS+=("--github-use-emoji-vote")
                         YETUS_ARGS+=("--github-use-emoji-vote")
 
 
+                        # test with Java 8 and 11
+                        YETUS_ARGS+=("--java-home=/usr/lib/jvm/java-8-openjdk-amd64")
+                        YETUS_ARGS+=("--multijdkdirs=/usr/lib/jvm/java-11-openjdk-amd64")
+                        YETUS_ARGS+=("--multijdktests=compile")
+
                         "${TESTPATCHBIN}" "${YETUS_ARGS[@]}"
                         "${TESTPATCHBIN}" "${YETUS_ARGS[@]}"
                         '''
                         '''
                 }
                 }

+ 13 - 40
dev-support/docker/Dockerfile

@@ -33,16 +33,10 @@ RUN echo APT::Install-Suggests "0"\; >>  /etc/apt/apt.conf.d/10disableextras
 ENV DEBIAN_FRONTEND noninteractive
 ENV DEBIAN_FRONTEND noninteractive
 ENV DEBCONF_TERSE true
 ENV DEBCONF_TERSE true
 
 
-######
-# Install common dependencies from packages. Versions here are either
-# sufficient or irrelevant.
-#
-# WARNING: DO NOT PUT JAVA APPS HERE! Otherwise they will install default
-# Ubuntu Java.  See Java section below!
-######
 # hadolint ignore=DL3008
 # hadolint ignore=DL3008
 RUN apt-get -q update \
 RUN apt-get -q update \
     && apt-get -q install -y --no-install-recommends \
     && apt-get -q install -y --no-install-recommends \
+        ant \
         apt-utils \
         apt-utils \
         bats \
         bats \
         build-essential \
         build-essential \
@@ -51,11 +45,13 @@ RUN apt-get -q update \
         cmake \
         cmake \
         curl \
         curl \
         doxygen \
         doxygen \
+        findbugs \
         fuse \
         fuse \
         g++ \
         g++ \
         gcc \
         gcc \
         git \
         git \
         gnupg-agent \
         gnupg-agent \
+        libbcprov-java \
         libbz2-dev \
         libbz2-dev \
         libcurl4-openssl-dev \
         libcurl4-openssl-dev \
         libfuse-dev \
         libfuse-dev \
@@ -64,11 +60,13 @@ RUN apt-get -q update \
         libsasl2-dev \
         libsasl2-dev \
         libsnappy-dev \
         libsnappy-dev \
         libssl-dev \
         libssl-dev \
-        libsnappy-dev \
         libtool \
         libtool \
         libzstd1-dev \
         libzstd1-dev \
         locales \
         locales \
         make \
         make \
+        maven \
+        openjdk-11-jdk \
+        openjdk-8-jdk \
         pinentry-curses \
         pinentry-curses \
         pkg-config \
         pkg-config \
         python \
         python \
@@ -86,15 +84,13 @@ RUN apt-get -q update \
     && apt-get clean \
     && apt-get clean \
     && rm -rf /var/lib/apt/lists/*
     && rm -rf /var/lib/apt/lists/*
 
 
-
-#######
-# OpenJDK 8
-#######
-# hadolint ignore=DL3008
-RUN apt-get -q update \
-    && apt-get -q install -y --no-install-recommends openjdk-8-jdk libbcprov-java \
-    && apt-get clean \
-    && rm -rf /var/lib/apt/lists/*
+######
+# Set env vars required to build Hadoop
+######
+ENV MAVEN_HOME /usr
+# JAVA_HOME must be set in Maven >= 3.5.0 (MNG-6003)
+ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
+ENV FINDBUGS_HOME /usr
 
 
 ######
 ######
 # Install Google Protobuf 3.7.1 (3.0.0 ships with Bionic)
 # Install Google Protobuf 3.7.1 (3.0.0 ships with Bionic)
@@ -113,29 +109,6 @@ RUN mkdir -p /opt/protobuf-src \
 ENV PROTOBUF_HOME /opt/protobuf
 ENV PROTOBUF_HOME /opt/protobuf
 ENV PATH "${PATH}:/opt/protobuf/bin"
 ENV PATH "${PATH}:/opt/protobuf/bin"
 
 
-######
-# Install Apache Maven 3.6.0 (3.6.0 ships with Bionic)
-######
-# hadolint ignore=DL3008
-RUN apt-get -q update \
-    && apt-get -q install -y --no-install-recommends maven \
-    && apt-get clean \
-    && rm -rf /var/lib/apt/lists/*
-ENV MAVEN_HOME /usr
-# JAVA_HOME must be set in Maven >= 3.5.0 (MNG-6003)
-ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
-
-######
-# Install findbugs 3.1.0 (3.1.0 ships with Bionic)
-# Ant is needed for findbugs
-######
-# hadolint ignore=DL3008
-RUN apt-get -q update \
-    && apt-get -q install -y --no-install-recommends findbugs ant \
-    && apt-get clean \
-    && rm -rf /var/lib/apt/lists/*
-ENV FINDBUGS_HOME /usr
-
 ####
 ####
 # Install pylint at fixed version (2.0.0 removed python2 support)
 # Install pylint at fixed version (2.0.0 removed python2 support)
 # https://github.com/PyCQA/pylint/issues/2294
 # https://github.com/PyCQA/pylint/issues/2294