2017-07-20 02:01:59 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
# distributed with this work for additional information
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
# to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance
|
|
|
|
# with the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing,
|
|
|
|
# software distributed under the License is distributed on an
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
# KIND, either express or implied. See the License for the
|
|
|
|
# specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
|
|
|
|
declare -i missing_env=0
|
|
|
|
# Validate params
|
2018-03-08 21:27:21 -05:00
|
|
|
for required_env in "TESTS" "PERSONALITY_FILE" "BASEDIR" "ARCHIVE_PATTERN_LIST" "OUTPUT_DIR_RELATIVE" \
|
|
|
|
"OUTPUT_DIR" "PROJECT" "AUTHOR_IGNORE_LIST" \
|
2017-07-20 02:01:59 -04:00
|
|
|
"WHITESPACE_IGNORE_LIST" "BRANCH_NAME" "TESTS_FILTER" "DEBUG" \
|
|
|
|
"USE_YETUS_PRERELEASE" "WORKSPACE" "YETUS_RELEASE"; do
|
|
|
|
if [ -z "${!required_env}" ]; then
|
|
|
|
echo "[ERROR] Required environment variable '${required_env}' is not set."
|
|
|
|
missing_env=${missing_env}+1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ ${missing_env} -gt 0 ]; then
|
|
|
|
echo "[ERROR] Please set the required environment variables before invoking. If this error is " \
|
|
|
|
"on Jenkins, then please file a JIRA about the error."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
YETUS_ARGS=()
|
|
|
|
if [[ -n "${MULTIJDK}" ]]; then
|
|
|
|
YETUS_ARGS=("--multijdktests=compile,javadoc" "${YETUS_ARGS[@]}")
|
|
|
|
YETUS_ARGS=("--multijdkdirs=${MULTIJDK}" "${YETUS_ARGS[@]}")
|
|
|
|
fi
|
|
|
|
|
2019-09-12 21:35:29 -04:00
|
|
|
# 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
|
2017-07-20 02:01:59 -04:00
|
|
|
if [[ -n "${SET_JAVA_HOME}" ]]; then
|
|
|
|
YETUS_ARGS=("--java-home=${SET_JAVA_HOME}" "${YETUS_ARGS[@]}")
|
|
|
|
fi
|
|
|
|
YETUS_ARGS=("--plugins=${TESTS}" "${YETUS_ARGS[@]}")
|
2018-03-08 21:27:21 -05:00
|
|
|
YETUS_ARGS=("--personality=${PERSONALITY_FILE}" "${YETUS_ARGS[@]}")
|
2017-07-20 02:01:59 -04:00
|
|
|
YETUS_ARGS=("--basedir=${BASEDIR}" "${YETUS_ARGS[@]}")
|
|
|
|
YETUS_ARGS=("--archive-list=${ARCHIVE_PATTERN_LIST}" "${YETUS_ARGS[@]}")
|
|
|
|
YETUS_ARGS=("--console-urls" "${YETUS_ARGS[@]}")
|
2017-12-20 16:27:25 -05:00
|
|
|
YETUS_ARGS=("--build-url-artifacts=artifact/${OUTPUT_DIR_RELATIVE}" "${YETUS_ARGS[@]}")
|
2017-07-20 02:01:59 -04:00
|
|
|
YETUS_ARGS=("--docker" "${YETUS_ARGS[@]}")
|
2018-03-08 21:27:21 -05:00
|
|
|
YETUS_ARGS=("--dockerfile=${BASEDIR}/dev-support/docker/Dockerfile" "${YETUS_ARGS[@]}")
|
2017-12-20 16:27:25 -05:00
|
|
|
# Yetus sets BUILDMODE env variable to "full" if this arg is passed.
|
2017-07-20 02:01:59 -04:00
|
|
|
YETUS_ARGS=("--empty-patch" "${YETUS_ARGS[@]}")
|
2017-12-20 16:27:25 -05:00
|
|
|
YETUS_ARGS=("--html-report-file=${OUTPUT_DIR}/console-report.html" "${YETUS_ARGS[@]}")
|
2017-07-20 02:01:59 -04:00
|
|
|
YETUS_ARGS=("--mvn-custom-repos" "${YETUS_ARGS[@]}")
|
2017-12-20 16:27:25 -05:00
|
|
|
YETUS_ARGS=("--patch-dir=${OUTPUT_DIR}" "${YETUS_ARGS[@]}")
|
2017-07-20 02:01:59 -04:00
|
|
|
YETUS_ARGS=("--project=${PROJECT}" "${YETUS_ARGS[@]}")
|
|
|
|
YETUS_ARGS=("--resetrepo" "${YETUS_ARGS[@]}")
|
|
|
|
YETUS_ARGS=("--author-ignore-list=${AUTHOR_IGNORE_LIST}" "${YETUS_ARGS[@]}")
|
|
|
|
YETUS_ARGS=("--whitespace-eol-ignore-list=${WHITESPACE_IGNORE_LIST}" "${YETUS_ARGS[@]}")
|
|
|
|
YETUS_ARGS=("--whitespace-tabs-ignore-list=${WHITESPACE_IGNORE_LIST}" "${YETUS_ARGS[@]}")
|
|
|
|
YETUS_ARGS=("--sentinel" "${YETUS_ARGS[@]}")
|
|
|
|
YETUS_ARGS=("--branch=${BRANCH_NAME}" "${YETUS_ARGS[@]}")
|
|
|
|
YETUS_ARGS=("--tests-filter=${TESTS_FILTER}" "${YETUS_ARGS[@]}")
|
2019-09-06 08:56:05 -04:00
|
|
|
YETUS_ARGS=("--ignore-unknown-options=true" "${YETUS_ARGS[@]}")
|
2018-02-02 13:54:40 -05:00
|
|
|
# Why are these not being picked up from hbase-personality?
|
|
|
|
YETUS_ARGS=("--proclimit=10000" "${YETUS_ARGS[@]}")
|
|
|
|
YETUS_ARGS=("--dockermemlimit=20g" "${YETUS_ARGS[@]}")
|
2017-07-20 02:01:59 -04:00
|
|
|
|
2019-09-22 14:35:50 -04:00
|
|
|
if [[ "$SKIP_ERRORPRONE" = true ]]; then
|
|
|
|
YETUS_ARGS=("--skip-errorprone" "${YETUS_ARGS[@]}")
|
|
|
|
fi
|
|
|
|
|
2018-01-12 19:22:06 -05:00
|
|
|
if [[ -n "${EXCLUDE_TESTS_URL}" ]]; then
|
2017-12-20 16:14:35 -05:00
|
|
|
YETUS_ARGS=("--exclude-tests-url=${EXCLUDE_TESTS_URL}" "${YETUS_ARGS[@]}")
|
|
|
|
fi
|
2018-01-12 19:22:06 -05:00
|
|
|
if [[ -n "${INCLUDE_TESTS_URL}" ]]; then
|
2017-12-20 16:14:35 -05:00
|
|
|
YETUS_ARGS=("--include-tests-url=${INCLUDE_TESTS_URL}" "${YETUS_ARGS[@]}")
|
|
|
|
fi
|
|
|
|
|
2017-12-21 14:20:40 -05:00
|
|
|
# For testing with specific hadoop version. Activates corresponding profile in maven runs.
|
|
|
|
if [[ -n "${HADOOP_PROFILE}" ]]; then
|
|
|
|
YETUS_ARGS=("--hadoop-profile=${HADOOP_PROFILE}" "${YETUS_ARGS[@]}")
|
|
|
|
fi
|
|
|
|
|
2017-07-20 02:01:59 -04:00
|
|
|
if [[ true == "${DEBUG}" ]]; then
|
|
|
|
YETUS_ARGS=("--debug" "${YETUS_ARGS[@]}")
|
|
|
|
fi
|
|
|
|
|
2018-04-11 11:38:12 -04:00
|
|
|
if [[ ! -d "${OUTPUT_DIR}" ]]; then
|
|
|
|
echo "[ERROR] the specified output directory must already exist: '${OUTPUT_DIR}'"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-07-20 02:01:59 -04:00
|
|
|
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"
|
|
|
|
else
|
|
|
|
YETUS_ARGS=("--shelldocs=${WORKSPACE}/yetus-git/shelldocs/shelldocs.py" "${YETUS_ARGS[@]}")
|
|
|
|
TESTPATCHBIN="${WORKSPACE}/yetus-git/precommit/test-patch.sh"
|
|
|
|
fi
|
|
|
|
echo "Launching yetus with command line:"
|
|
|
|
echo "${TESTPATCHBIN} ${YETUS_ARGS[*]}"
|
|
|
|
|
|
|
|
/usr/bin/env bash "${TESTPATCHBIN}" "${YETUS_ARGS[@]}"
|