HBASE-27475 Use different jdks when running hadoopcheck in personality scripts (#4875)

Signed-off-by: GeorryHuang <huangzhuoyue@apache.org>
Signed-off-by: Guanghao Zhang <zghao@apache.org>
(cherry picked from commit 260cd485db)
This commit is contained in:
Duo Zhang 2022-11-10 23:12:39 +08:00
parent e605ebf8b1
commit 7060a5898f
5 changed files with 21 additions and 0 deletions

View File

@ -203,6 +203,7 @@ pipeline {
BASEDIR = "${env.WORKSPACE}/component" BASEDIR = "${env.WORKSPACE}/component"
TESTS = "${env.SHALLOW_CHECKS}" TESTS = "${env.SHALLOW_CHECKS}"
SET_JAVA_HOME = "/usr/lib/jvm/java-11" SET_JAVA_HOME = "/usr/lib/jvm/java-11"
JAVA8_HOME="/usr/lib/jvm/java-8"
// Activates hadoop 3.0 profile in maven runs. // Activates hadoop 3.0 profile in maven runs.
HADOOP_PROFILE = '3.0' HADOOP_PROFILE = '3.0'
OUTPUT_DIR_RELATIVE = "${env.OUTPUT_DIR_RELATIVE_GENERAL}" OUTPUT_DIR_RELATIVE = "${env.OUTPUT_DIR_RELATIVE_GENERAL}"

View File

@ -79,6 +79,8 @@ pipeline {
// customized per parallel stage // customized per parallel stage
PLUGINS = "${GENERAL_CHECK_PLUGINS}" PLUGINS = "${GENERAL_CHECK_PLUGINS}"
SET_JAVA_HOME = "/usr/lib/jvm/java-11" 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}" WORKDIR_REL = "${WORKDIR_REL_GENERAL_CHECK}"
// identical for all parallel stages // identical for all parallel stages
WORKDIR = "${WORKSPACE}/${WORKDIR_REL}" WORKDIR = "${WORKSPACE}/${WORKDIR_REL}"

View File

@ -131,6 +131,10 @@ function personality_parse_args
delete_parameter "${i}" delete_parameter "${i}"
SUREFIRE_SECOND_PART_FORK_COUNT=${i#*=} SUREFIRE_SECOND_PART_FORK_COUNT=${i#*=}
;; ;;
--java8-home=*)
delete_parameter "${i}"
JAVA8_HOME=${i#*=}
;;
esac esac
done done
} }
@ -560,6 +564,7 @@ function hadoopcheck_rebuild
local result=0 local result=0
local hbase_hadoop2_versions local hbase_hadoop2_versions
local hbase_hadoop3_versions local hbase_hadoop3_versions
local savejavahome=${JAVA_HOME}
if [[ "${repostatus}" = branch ]]; then if [[ "${repostatus}" = branch ]]; then
return 0 return 0
@ -609,12 +614,18 @@ function hadoopcheck_rebuild
export MAVEN_OPTS="${MAVEN_OPTS}" export MAVEN_OPTS="${MAVEN_OPTS}"
for hadoopver in ${hbase_hadoop2_versions}; do for hadoopver in ${hbase_hadoop2_versions}; do
logfile="${PATCH_DIR}/patch-javac-${hadoopver}.txt" 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 # disabled because "maven_executor" needs to return both command and args
# shellcheck disable=2046 # shellcheck disable=2046
echo_and_redirect "${logfile}" \ echo_and_redirect "${logfile}" \
$(maven_executor) clean install \ $(maven_executor) clean install \
-DskipTests -DHBasePatchProcess \ -DskipTests -DHBasePatchProcess \
-Dhadoop-two.version="${hadoopver}" -Dhadoop-two.version="${hadoopver}"
export JAVA_HOME=${savejavahome}
count=$(${GREP} -c '\[ERROR\]' "${logfile}") count=$(${GREP} -c '\[ERROR\]' "${logfile}")
if [[ ${count} -gt 0 ]]; then if [[ ${count} -gt 0 ]]; then
add_vote_table -1 hadoopcheck "${BUILDMODEMSG} causes ${count} errors with Hadoop v${hadoopver}." add_vote_table -1 hadoopcheck "${BUILDMODEMSG} causes ${count} errors with Hadoop v${hadoopver}."

View File

@ -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[@]}") YETUS_ARGS=("--asf-nightlies-general-check-base=${ASF_NIGHTLIES_GENERAL_CHECK_BASE}" "${YETUS_ARGS[@]}")
fi fi
if [[ -n "${JAVA8_HOME}" ]]; then
YETUS_ARGS=("--java8-home=${JAVA8_HOME}" "${YETUS_ARGS[@]}")
fi
if [[ true != "${USE_YETUS_PRERELEASE}" ]]; then if [[ true != "${USE_YETUS_PRERELEASE}" ]]; then
YETUS_ARGS=("--shelldocs=${WORKSPACE}/yetus-${YETUS_RELEASE}/bin/shelldocs" "${YETUS_ARGS[@]}") YETUS_ARGS=("--shelldocs=${WORKSPACE}/yetus-${YETUS_RELEASE}/bin/shelldocs" "${YETUS_ARGS[@]}")
TESTPATCHBIN="${WORKSPACE}/yetus-${YETUS_RELEASE}/bin/test-patch" TESTPATCHBIN="${WORKSPACE}/yetus-${YETUS_RELEASE}/bin/test-patch"

View File

@ -157,6 +157,9 @@ fi
if [[ -n "${SUREFIRE_SECOND_PART_FORK_COUNT}" ]]; then if [[ -n "${SUREFIRE_SECOND_PART_FORK_COUNT}" ]]; then
YETUS_ARGS+=("--surefire-second-part-fork-count=${SUREFIRE_SECOND_PART_FORK_COUNT}") YETUS_ARGS+=("--surefire-second-part-fork-count=${SUREFIRE_SECOND_PART_FORK_COUNT}")
fi fi
if [[ -n "${JAVA8_HOME}" ]]; then
YETUS_ARGS+=("--java8-home=${JAVA8_HOME}")
fi
echo "Launching yetus with command line:" echo "Launching yetus with command line:"
echo "${TESTPATCHBIN} ${YETUS_ARGS[*]}" echo "${TESTPATCHBIN} ${YETUS_ARGS[*]}"