You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bu...@apache.org on 2019/09/17 04:01:25 UTC

[hbase] branch branch-1 updated: HBASE-22955 Properly set jdk7 as JAVA_HOME for branches-1 precommit and nightly. (#621)

This is an automated email from the ASF dual-hosted git repository.

busbey pushed a commit to branch branch-1
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-1 by this push:
     new 41990ba  HBASE-22955 Properly set jdk7 as JAVA_HOME for branches-1 precommit and nightly. (#621)
41990ba is described below

commit 41990ba20aab61379d6cf575b7eb2776eb55d883
Author: Sean Busbey <bu...@apache.org>
AuthorDate: Thu Sep 12 20:35:29 2019 -0500

    HBASE-22955 Properly set jdk7 as JAVA_HOME for branches-1 precommit and nightly. (#621)
    
    * leave Zulu JDKs at their normal location
    * set JAVA_HOME in the dockerfile
    * work around yetus setting a different JAVA_HOME
    
    Signed-off-by: Nick Dimiduk <nd...@apache.org>
---
 dev-support/Jenkinsfile            | 18 +++++++++---------
 dev-support/Jenkinsfile_GitHub     |  7 ++++++-
 dev-support/docker/Dockerfile      |  9 ++-------
 dev-support/hbase-personality.sh   | 17 +++++++++++++++++
 dev-support/hbase_nightly_yetus.sh |  4 ++++
 5 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/dev-support/Jenkinsfile b/dev-support/Jenkinsfile
index 48e53d6..0b3f3ac 100644
--- a/dev-support/Jenkinsfile
+++ b/dev-support/Jenkinsfile
@@ -131,9 +131,11 @@ curl -L  -o personality.sh "${env.PROJECT_PERSONALITY}"
             // TODO does hadoopcheck need to be jdk specific?
             // Should be things that work with multijdk
             TESTS = 'all,-unit,-findbugs'
-            // on branches that don't support jdk7, this will already be JAVA_HOME, so we'll end up not
-            // doing multijdk there.
-            MULTIJDK = '/usr/lib/jvm/java-8-openjdk-amd64'
+            // all jdks tested on this stage for this branch
+            // note that JAVA_HOME still needs to be set for tests
+            // that don't support multijdk. JAVA_HOME will also
+            // determine which jvm will be tested last.
+            MULTIJDK = '/usr/lib/jvm/zulu-8-amd64,/usr/lib/jvm/zulu-7-amd64'
             OUTPUT_DIR_RELATIVE = "${env.OUTPUT_DIR_RELATIVE_GENERAL}"
             OUTPUT_DIR = "${env.WORKSPACE}/${env.OUTPUT_DIR_RELATIVE_GENERAL}"
           }
@@ -280,9 +282,8 @@ curl -L  -o personality.sh "${env.PROJECT_PERSONALITY}"
             TESTS = 'maven,mvninstall,compile,javac,unit,findbugs,htmlout'
             OUTPUT_DIR_RELATIVE = "${env.OUTPUT_DIR_RELATIVE_HADOOP2}"
             OUTPUT_DIR = "${env.WORKSPACE}/${env.OUTPUT_DIR_RELATIVE_HADOOP2}"
-            // This isn't strictly needed on branches that only support jdk8, but doesn't hurt
-            // and is needed on branches that do both jdk7 and jdk8
-            SET_JAVA_HOME = '/usr/lib/jvm/java-8-openjdk-amd64'
+            // this is branch-1 specific. the branch-2+ version uses openjdk artifacts
+            SET_JAVA_HOME = '/usr/lib/jvm/zulu-8-amd64'
           }
           steps {
             // Must do prior to anything else, since if one of them timesout we'll stash the commentfile
@@ -365,9 +366,8 @@ curl -L  -o personality.sh "${env.PROJECT_PERSONALITY}"
             TESTS = 'maven,mvninstall,compile,javac,unit,htmlout'
             OUTPUT_DIR_RELATIVE = "${env.OUTPUT_DIR_RELATIVE_HADOOP3}"
             OUTPUT_DIR = "${env.WORKSPACE}/${env.OUTPUT_DIR_RELATIVE_HADOOP3}"
-            // This isn't strictly needed on branches that only support jdk8, but doesn't hurt
-            // and is needed on branches that do both jdk7 and jdk8
-            SET_JAVA_HOME = '/usr/lib/jvm/java-8-openjdk-amd64'
+            // this is branch-1 specific. the branch-2+ version uses openjdk artifacts
+            SET_JAVA_HOME = '/usr/lib/jvm/zulu-8-amd64'
             // Activates hadoop 3.0 profile in maven runs.
             HADOOP_PROFILE = '3.0'
           }
diff --git a/dev-support/Jenkinsfile_GitHub b/dev-support/Jenkinsfile_GitHub
index 0b47058..4948f5a 100644
--- a/dev-support/Jenkinsfile_GitHub
+++ b/dev-support/Jenkinsfile_GitHub
@@ -110,6 +110,10 @@ pipeline {
                         if [[ "true" = "${DEBUG}" ]]; then
                             YETUS_ARGS+=("--debug")
                         fi
+                        # If we're doing docker, make sure we don't accidentally pollute the image with a host java path
+                        if [ -n "${JAVA_HOME}" ]; then
+                          unset JAVA_HOME
+                        fi
                         YETUS_ARGS+=("--patch-dir=${WORKSPACE}/${PATCHDIR}")
                         # where the source is located
                         YETUS_ARGS+=("--basedir=${WORKSPACE}/${SOURCEDIR}")
@@ -151,7 +155,8 @@ pipeline {
                         YETUS_ARGS+=("--docker")
                         YETUS_ARGS+=("--dockerfile=${DOCKERFILE}")
                         YETUS_ARGS+=("--mvn-custom-repos")
-                        YETUS_ARGS+=("--multijdkdirs=/usr/lib/jvm/java-8-openjdk-amd64")
+                        # Branch-1 specific, look at the Zulu jdk8
+                        YETUS_ARGS+=("--multijdkdirs=/usr/lib/jvm/zulu-8-amd64,/usr/lib/jvm/zulu-7-amd64")
                         YETUS_ARGS+=("--findbugs-home=/usr")
                         YETUS_ARGS+=("--whitespace-eol-ignore-list=.*/generated/.*")
                         YETUS_ARGS+=("--whitespace-tabs-ignore-list=.*/generated/.*")
diff --git a/dev-support/docker/Dockerfile b/dev-support/docker/Dockerfile
index e4daee2..bd6c9ce 100644
--- a/dev-support/docker/Dockerfile
+++ b/dev-support/docker/Dockerfile
@@ -84,10 +84,7 @@ RUN apt-get -q update && apt-get -q install --no-install-recommends -y \
 # See HBASE-19204. So, we use the azul jdks because they are available, and
 # later versions of openjdk (openjdk-7 161). Below we add the azul repo and
 # then install its jdks. We then move aside the headless jdk7 added above
-# when we added maven and ant and rename the azul jvms as
-# though they were from openjdk (otherwise yetus won't set JAVA_HOME;
-# it does find /usr/lib/jvm/ -name java-* -type d so a symlink to the zulu jvms
-# won't work).
+# when we added maven and ant
 RUN echo "dot_style = mega" > "/root/.wgetrc"
 RUN echo "quiet = on" >> "/root/.wgetrc"
 RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x219BD9C9
@@ -98,9 +95,7 @@ RUN apt-get -q install --no-install-recommends -y zulu-8 zulu-7
 RUN update-alternatives --config java
 RUN update-alternatives --config javac
 RUN mv /usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/moved.java-7-openjdk-amd64
-RUN mv /usr/lib/jvm/zulu-7-amd64 /usr/lib/jvm/java-7-openjdk-amd64 
-RUN mv /usr/lib/jvm/zulu-8-amd64 /usr/lib/jvm/java-8-openjdk-amd64 
-
+ENV JAVA_HOME /usr/lib/jvm/zulu-7-amd64
 
 # Fixing the Apache commons / Maven dependency problem under Ubuntu:
 # See http://wiki.apache.org/commons/VfsProblems
diff --git a/dev-support/hbase-personality.sh b/dev-support/hbase-personality.sh
index c2be772..aaec957 100755
--- a/dev-support/hbase-personality.sh
+++ b/dev-support/hbase-personality.sh
@@ -45,6 +45,23 @@ if ! declare -f "yetus_info" >/dev/null; then
 
 fi
 
+# work around yetus overwriting JAVA_HOME from our docker image
+function docker_do_env_adds
+{
+  declare k
+
+  for k in "${DOCKER_EXTRAENVS[@]}"; do
+    if [[ "JAVA_HOME" == "${k}" ]]; then
+      if [ -n "${JAVA_HOME}" ]; then
+        DOCKER_EXTRAARGS+=("--env=JAVA_HOME=${JAVA_HOME}")
+      fi
+    else
+      DOCKER_EXTRAARGS+=("--env=${k}=${!k}")
+    fi
+  done
+}
+
+
 ## @description  Globals specific to this personality
 ## @audience     private
 ## @stability    evolving
diff --git a/dev-support/hbase_nightly_yetus.sh b/dev-support/hbase_nightly_yetus.sh
index 3c9e270..9159057 100755
--- a/dev-support/hbase_nightly_yetus.sh
+++ b/dev-support/hbase_nightly_yetus.sh
@@ -40,6 +40,10 @@ if [[ -n "${MULTIJDK}" ]]; then
   YETUS_ARGS=("--multijdkdirs=${MULTIJDK}" "${YETUS_ARGS[@]}")
 fi
 
+# If we're doing docker, make sure we don't accidentally pollute the image with a host java path
+if [ -n "${JAVA_HOME}" ]; then
+  unset JAVA_HOME
+fi
 if [[ -n "${SET_JAVA_HOME}" ]]; then
   YETUS_ARGS=("--java-home=${SET_JAVA_HOME}" "${YETUS_ARGS[@]}")
 fi