From 1cbed077f1de2fc3d38a44b1ecec06df26fe391b Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Thu, 12 Sep 2019 20:35:29 -0500 Subject: [PATCH] HBASE-22955 Properly set jdk7 as JAVA_HOME for branches-1 precommit and nightly. (#621) master/branches-2 specific changes: work around yetus overwriting JAVA_HOME in the container with the host JAVA_HOME. Signed-off-by: Nick Dimiduk (cherry picked from commit 41990ba20aab61379d6cf575b7eb2776eb55d883) (cherry picked from commit bcad0d9f98b61141e82969686df93fcda171c61c) --- dev-support/Jenkinsfile_GitHub | 4 ++++ dev-support/hbase-personality.sh | 17 +++++++++++++++++ dev-support/hbase_nightly_yetus.sh | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/dev-support/Jenkinsfile_GitHub b/dev-support/Jenkinsfile_GitHub index 693a1c8a17c..c9f5f1780a3 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}") diff --git a/dev-support/hbase-personality.sh b/dev-support/hbase-personality.sh index b4b7880888f..84b90be83d4 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 3c9e270c39b..91590576e20 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