HBASE-24458 release scripts using docker should specify needed disk consistency
[hbase.git] / dev-support / hbase_nightly_yetus.sh
blob65b5270f0bf8c3999c918c625c1d163ed7e5bd92
1 #!/usr/bin/env bash
2 # Licensed to the Apache Software Foundation (ASF) under one
3 # or more contributor license agreements. See the NOTICE file
4 # distributed with this work for additional information
5 # regarding copyright ownership. The ASF licenses this file
6 # to you under the Apache License, Version 2.0 (the
7 # "License"); you may not use this file except in compliance
8 # with the License. You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing,
13 # software distributed under the License is distributed on an
14 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 # KIND, either express or implied. See the License for the
16 # specific language governing permissions and limitations
17 # under the License.
19 declare -i missing_env=0
20 # Validate params
21 for required_env in "TESTS" "PERSONALITY_FILE" "BASEDIR" "ARCHIVE_PATTERN_LIST" "OUTPUT_DIR_RELATIVE" \
22 "OUTPUT_DIR" "PROJECT" "AUTHOR_IGNORE_LIST" \
23 "WHITESPACE_IGNORE_LIST" "BRANCH_NAME" "TESTS_FILTER" "DEBUG" \
24 "USE_YETUS_PRERELEASE" "WORKSPACE" "YETUS_RELEASE"; do
25 if [ -z "${!required_env}" ]; then
26 echo "[ERROR] Required environment variable '${required_env}' is not set."
27 missing_env=${missing_env}+1
29 done
31 if [ ${missing_env} -gt 0 ]; then
32 echo "[ERROR] Please set the required environment variables before invoking. If this error is " \
33 "on Jenkins, then please file a JIRA about the error."
34 exit 1
37 YETUS_ARGS=()
39 # If we're doing docker, make sure we don't accidentally pollute the image with a host java path
40 if [ -n "${JAVA_HOME}" ]; then
41 unset JAVA_HOME
43 if [[ -n "${SET_JAVA_HOME}" ]]; then
44 YETUS_ARGS=("--java-home=${SET_JAVA_HOME}" "${YETUS_ARGS[@]}")
46 YETUS_ARGS=("--plugins=${TESTS}" "${YETUS_ARGS[@]}")
47 YETUS_ARGS=("--personality=${PERSONALITY_FILE}" "${YETUS_ARGS[@]}")
48 YETUS_ARGS=("--basedir=${BASEDIR}" "${YETUS_ARGS[@]}")
49 YETUS_ARGS=("--archive-list=${ARCHIVE_PATTERN_LIST}" "${YETUS_ARGS[@]}")
50 YETUS_ARGS=("--console-urls" "${YETUS_ARGS[@]}")
51 YETUS_ARGS=("--build-url-artifacts=artifact/${OUTPUT_DIR_RELATIVE}" "${YETUS_ARGS[@]}")
52 YETUS_ARGS=("--docker" "${YETUS_ARGS[@]}")
53 YETUS_ARGS=("--dockerfile=${BASEDIR}/dev-support/docker/Dockerfile" "${YETUS_ARGS[@]}")
54 # Yetus sets BUILDMODE env variable to "full" if this arg is passed.
55 YETUS_ARGS=("--empty-patch" "${YETUS_ARGS[@]}")
56 YETUS_ARGS=("--html-report-file=${OUTPUT_DIR}/console-report.html" "${YETUS_ARGS[@]}")
57 YETUS_ARGS=("--mvn-custom-repos" "${YETUS_ARGS[@]}")
58 YETUS_ARGS=("--patch-dir=${OUTPUT_DIR}" "${YETUS_ARGS[@]}")
59 YETUS_ARGS=("--project=${PROJECT}" "${YETUS_ARGS[@]}")
60 YETUS_ARGS=("--resetrepo" "${YETUS_ARGS[@]}")
61 YETUS_ARGS=("--author-ignore-list=${AUTHOR_IGNORE_LIST}" "${YETUS_ARGS[@]}")
62 YETUS_ARGS=("--whitespace-eol-ignore-list=${WHITESPACE_IGNORE_LIST}" "${YETUS_ARGS[@]}")
63 YETUS_ARGS=("--whitespace-tabs-ignore-list=${WHITESPACE_IGNORE_LIST}" "${YETUS_ARGS[@]}")
64 YETUS_ARGS=("--sentinel" "${YETUS_ARGS[@]}")
65 YETUS_ARGS=("--branch=${BRANCH_NAME}" "${YETUS_ARGS[@]}")
66 YETUS_ARGS=("--tests-filter=${TESTS_FILTER}" "${YETUS_ARGS[@]}")
67 YETUS_ARGS=("--ignore-unknown-options=true" "${YETUS_ARGS[@]}")
68 YETUS_ARGS=("--dockermemlimit=20g" "${YETUS_ARGS[@]}")
70 if [[ -n "${EXCLUDE_TESTS_URL}" ]]; then
71 YETUS_ARGS=("--exclude-tests-url=${EXCLUDE_TESTS_URL}" "${YETUS_ARGS[@]}")
73 if [[ -n "${INCLUDE_TESTS_URL}" ]]; then
74 YETUS_ARGS=("--include-tests-url=${INCLUDE_TESTS_URL}" "${YETUS_ARGS[@]}")
77 # For testing with specific hadoop version. Activates corresponding profile in maven runs.
78 if [[ -n "${HADOOP_PROFILE}" ]]; then
79 # Master has only Hadoop3 support. We don't need to activate any profile.
80 # The Jenkinsfile should not attempt to run any Hadoop2 tests.
81 if [[ "${BRANCH_NAME}" =~ branch-2* ]]; then
82 YETUS_ARGS=("--hadoop-profile=${HADOOP_PROFILE}" "${YETUS_ARGS[@]}")
86 if [[ -n "${SKIP_ERROR_PRONE}" ]]; then
87 YETUS_ARGS=("--skip-errorprone" "${YETUS_ARGS[@]}")
90 if [[ true == "${DEBUG}" ]]; then
91 YETUS_ARGS=("--debug" "${YETUS_ARGS[@]}")
94 if [[ ! -d "${OUTPUT_DIR}" ]]; then
95 echo "[ERROR] the specified output directory must already exist: '${OUTPUT_DIR}'"
96 exit 1
99 if [[ true != "${USE_YETUS_PRERELEASE}" ]]; then
100 YETUS_ARGS=("--shelldocs=${WORKSPACE}/yetus-${YETUS_RELEASE}/bin/shelldocs" "${YETUS_ARGS[@]}")
101 TESTPATCHBIN="${WORKSPACE}/yetus-${YETUS_RELEASE}/bin/test-patch"
102 else
103 YETUS_ARGS=("--shelldocs=${WORKSPACE}/yetus-git/shelldocs/shelldocs.py" "${YETUS_ARGS[@]}")
104 TESTPATCHBIN="${WORKSPACE}/yetus-git/precommit/test-patch.sh"
106 echo "Launching yetus with command line:"
107 echo "${TESTPATCHBIN} ${YETUS_ARGS[*]}"
109 /usr/bin/env bash "${TESTPATCHBIN}" "${YETUS_ARGS[@]}"