From 7060a5898f355b5ba5c2c9e6b2b8dda228af2848 Mon Sep 17 00:00:00 2001 From: Duo Zhang Date: Thu, 10 Nov 2022 23:12:39 +0800 Subject: [PATCH] HBASE-27475 Use different jdks when running hadoopcheck in personality scripts (#4875) Signed-off-by: GeorryHuang Signed-off-by: Guanghao Zhang (cherry picked from commit 260cd485db36f8d04b91062012addc632ca29ec9) --- dev-support/Jenkinsfile | 1 + dev-support/Jenkinsfile_GitHub | 2 ++ dev-support/hbase-personality.sh | 11 +++++++++++ dev-support/hbase_nightly_yetus.sh | 4 ++++ dev-support/jenkins_precommit_github_yetus.sh | 3 +++ 5 files changed, 21 insertions(+) diff --git a/dev-support/Jenkinsfile b/dev-support/Jenkinsfile index 8bbb00ebbb9..7c8d427650f 100644 --- a/dev-support/Jenkinsfile +++ b/dev-support/Jenkinsfile @@ -203,6 +203,7 @@ pipeline { BASEDIR = "${env.WORKSPACE}/component" TESTS = "${env.SHALLOW_CHECKS}" SET_JAVA_HOME = "/usr/lib/jvm/java-11" + JAVA8_HOME="/usr/lib/jvm/java-8" // Activates hadoop 3.0 profile in maven runs. HADOOP_PROFILE = '3.0' OUTPUT_DIR_RELATIVE = "${env.OUTPUT_DIR_RELATIVE_GENERAL}" diff --git a/dev-support/Jenkinsfile_GitHub b/dev-support/Jenkinsfile_GitHub index ac548757df2..753ecaaa5b5 100644 --- a/dev-support/Jenkinsfile_GitHub +++ b/dev-support/Jenkinsfile_GitHub @@ -79,6 +79,8 @@ pipeline { // customized per parallel stage PLUGINS = "${GENERAL_CHECK_PLUGINS}" SET_JAVA_HOME = "/usr/lib/jvm/java-11" + JAVA8_HOME = "/usr/lib/jvm/java-8" + HADOOP_PROFILE = '3.0' WORKDIR_REL = "${WORKDIR_REL_GENERAL_CHECK}" // identical for all parallel stages WORKDIR = "${WORKSPACE}/${WORKDIR_REL}" diff --git a/dev-support/hbase-personality.sh b/dev-support/hbase-personality.sh index efe84345f06..bd67fe1fdec 100755 --- a/dev-support/hbase-personality.sh +++ b/dev-support/hbase-personality.sh @@ -131,6 +131,10 @@ function personality_parse_args delete_parameter "${i}" SUREFIRE_SECOND_PART_FORK_COUNT=${i#*=} ;; + --java8-home=*) + delete_parameter "${i}" + JAVA8_HOME=${i#*=} + ;; esac done } @@ -560,6 +564,7 @@ function hadoopcheck_rebuild local result=0 local hbase_hadoop2_versions local hbase_hadoop3_versions + local savejavahome=${JAVA_HOME} if [[ "${repostatus}" = branch ]]; then return 0 @@ -609,12 +614,18 @@ function hadoopcheck_rebuild export MAVEN_OPTS="${MAVEN_OPTS}" for hadoopver in ${hbase_hadoop2_versions}; do logfile="${PATCH_DIR}/patch-javac-${hadoopver}.txt" + # alawys use java8 to build with hadoop 2.x + if [[ -n "${JAVA8_HOME}" ]]; then + yetus_info "Switching to java 8 for building against hadoop 2.x" + export JAVA_HOME=${JAVA8_HOME} + fi # disabled because "maven_executor" needs to return both command and args # shellcheck disable=2046 echo_and_redirect "${logfile}" \ $(maven_executor) clean install \ -DskipTests -DHBasePatchProcess \ -Dhadoop-two.version="${hadoopver}" + export JAVA_HOME=${savejavahome} count=$(${GREP} -c '\[ERROR\]' "${logfile}") if [[ ${count} -gt 0 ]]; then add_vote_table -1 hadoopcheck "${BUILDMODEMSG} causes ${count} errors with Hadoop v${hadoopver}." diff --git a/dev-support/hbase_nightly_yetus.sh b/dev-support/hbase_nightly_yetus.sh index 3fb1ac7bfce..d824412835c 100755 --- a/dev-support/hbase_nightly_yetus.sh +++ b/dev-support/hbase_nightly_yetus.sh @@ -101,6 +101,10 @@ if [[ -n "${ASF_NIGHTLIES_GENERAL_CHECK_BASE}" ]]; then YETUS_ARGS=("--asf-nightlies-general-check-base=${ASF_NIGHTLIES_GENERAL_CHECK_BASE}" "${YETUS_ARGS[@]}") fi +if [[ -n "${JAVA8_HOME}" ]]; then + YETUS_ARGS=("--java8-home=${JAVA8_HOME}" "${YETUS_ARGS[@]}") +fi + if [[ true != "${USE_YETUS_PRERELEASE}" ]]; then YETUS_ARGS=("--shelldocs=${WORKSPACE}/yetus-${YETUS_RELEASE}/bin/shelldocs" "${YETUS_ARGS[@]}") TESTPATCHBIN="${WORKSPACE}/yetus-${YETUS_RELEASE}/bin/test-patch" diff --git a/dev-support/jenkins_precommit_github_yetus.sh b/dev-support/jenkins_precommit_github_yetus.sh index c3da3263556..f5a7315b2d2 100755 --- a/dev-support/jenkins_precommit_github_yetus.sh +++ b/dev-support/jenkins_precommit_github_yetus.sh @@ -157,6 +157,9 @@ fi if [[ -n "${SUREFIRE_SECOND_PART_FORK_COUNT}" ]]; then YETUS_ARGS+=("--surefire-second-part-fork-count=${SUREFIRE_SECOND_PART_FORK_COUNT}") fi +if [[ -n "${JAVA8_HOME}" ]]; then + YETUS_ARGS+=("--java8-home=${JAVA8_HOME}") +fi echo "Launching yetus with command line:" echo "${TESTPATCHBIN} ${YETUS_ARGS[*]}"