HBASE-24031 TestHRegion.testCheckAndMutate_WithFilters is flaky (#1316)
[hbase.git] / dev-support / jenkins_precommit_github_yetus.sh
blobe0ead27f0abe07768ff7b7a0059194523b2c828b
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 set -e
21 # place ourselves in the directory containing the hbase and yetus checkouts
22 cd "$(dirname "$0")/../.."
23 echo "executing from $(pwd)"
25 if [[ "true" = "${DEBUG}" ]]; then
26 set -x
27 printenv 2>&1 | sort
30 declare -i missing_env=0
31 declare -a required_envs=(
32 # these ENV variables define the required API with Jenkinsfile_GitHub
33 "ARCHIVE_PATTERN_LIST"
34 "BUILD_URL_ARTIFACTS"
35 "DOCKERFILE"
36 "GITHUB_PASSWORD"
37 "GITHUB_USER"
38 "PATCHDIR"
39 "PLUGINS"
40 "SET_JAVA_HOME"
41 "SOURCEDIR"
42 "TESTS_FILTER"
43 "YETUSDIR"
45 # Validate params
46 for required_env in "${required_envs[@]}"; do
47 if [ -z "${!required_env}" ]; then
48 echo "[ERROR] Required environment variable '${required_env}' is not set."
49 missing_env=${missing_env}+1
51 done
53 if [ ${missing_env} -gt 0 ]; then
54 echo "[ERROR] Please set the required environment variables before invoking. If this error is " \
55 "on Jenkins, then please file a JIRA about the error."
56 exit 1
59 # TODO (HBASE-23900): cannot assume test-patch runs directly from sources
60 TESTPATCHBIN="${YETUSDIR}/precommit/src/main/shell/test-patch.sh"
62 # this must be clean for every run
63 rm -rf "${PATCHDIR}"
64 mkdir -p "${PATCHDIR}"
66 # Checking on H* machine nonsense
67 mkdir "${PATCHDIR}/machine"
68 "${SOURCEDIR}/dev-support/gather_machine_environment.sh" "${PATCHDIR}/machine"
70 # If CHANGE_URL is set (e.g., Github Branch Source plugin), process it.
71 # Otherwise exit, because we don't want HBase to do a
72 # full build. We wouldn't normally do this check for smaller
73 # projects. :)
74 if [[ -z "${CHANGE_URL}" ]]; then
75 echo "Full build skipped" > "${PATCHDIR}/report.html"
76 exit 0
78 # enable debug output for yetus
79 if [[ "true" = "${DEBUG}" ]]; then
80 YETUS_ARGS+=("--debug")
82 # If we're doing docker, make sure we don't accidentally pollute the image with a host java path
83 if [ -n "${JAVA_HOME}" ]; then
84 unset JAVA_HOME
86 YETUS_ARGS+=("--ignore-unknown-options=true")
87 YETUS_ARGS+=("--patch-dir=${PATCHDIR}")
88 # where the source is located
89 YETUS_ARGS+=("--basedir=${SOURCEDIR}")
90 # our project defaults come from a personality file
91 # which will get loaded automatically by setting the project name
92 YETUS_ARGS+=("--project=hbase")
93 # lots of different output formats
94 YETUS_ARGS+=("--brief-report-file=${PATCHDIR}/brief.txt")
95 YETUS_ARGS+=("--console-report-file=${PATCHDIR}/console.txt")
96 YETUS_ARGS+=("--html-report-file=${PATCHDIR}/report.html")
97 # enable writing back to Github
98 YETUS_ARGS+=("--github-password=${GITHUB_PASSWORD}")
99 YETUS_ARGS+=("--github-user=${GITHUB_USER}")
100 # auto-kill any surefire stragglers during unit test runs
101 YETUS_ARGS+=("--reapermode=kill")
102 # set relatively high limits for ASF machines
103 # changing these to higher values may cause problems
104 # with other jobs on systemd-enabled machines
105 YETUS_ARGS+=("--proclimit=10000")
106 YETUS_ARGS+=("--dockermemlimit=20g")
107 # -1 spotbugs issues that show up prior to the patch being applied
108 YETUS_ARGS+=("--spotbugs-strict-precheck")
109 # rsync these files back into the archive dir
110 YETUS_ARGS+=("--archive-list=${ARCHIVE_PATTERN_LIST}")
111 # URL for user-side presentation in reports and such to our artifacts
112 YETUS_ARGS+=("--build-url-artifacts=${BUILD_URL_ARTIFACTS}")
113 # plugins to enable
114 YETUS_ARGS+=("--plugins=${PLUGINS},-findbugs")
115 # run in docker mode and specifically point to our
116 # Dockerfile since we don't want to use the auto-pulled version.
117 YETUS_ARGS+=("--docker")
118 YETUS_ARGS+=("--dockerfile=${DOCKERFILE}")
119 YETUS_ARGS+=("--mvn-custom-repos")
120 YETUS_ARGS+=("--java-home=${SET_JAVA_HOME}")
121 YETUS_ARGS+=("--whitespace-eol-ignore-list=.*/generated/.*")
122 YETUS_ARGS+=("--whitespace-tabs-ignore-list=.*/generated/.*")
123 YETUS_ARGS+=("--tests-filter=${TESTS_FILTER}")
124 YETUS_ARGS+=("--personality=${SOURCEDIR}/dev-support/hbase-personality.sh")
125 YETUS_ARGS+=("--quick-hadoopcheck")
126 YETUS_ARGS+=("--skip-errorprone")
127 # effectively treat dev-support as a custom maven module
128 YETUS_ARGS+=("--skip-dirs=dev-support")
129 # For testing with specific hadoop version. Activates corresponding profile in maven runs.
130 if [[ -n "${HADOOP_PROFILE}" ]]; then
131 YETUS_ARGS+=("--hadoop-profile=${HADOOP_PROFILE}")
133 if [[ -n "${EXCLUDE_TESTS_URL}" ]]; then
134 YETUS_ARGS+=("--exclude-tests-url=${EXCLUDE_TESTS_URL}")
136 # help keep the ASF boxes clean
137 YETUS_ARGS+=("--sentinel")
138 # use emoji vote so it is easier to find the broken line
139 YETUS_ARGS+=("--github-use-emoji-vote")
141 echo "Launching yetus with command line:"
142 echo "${TESTPATCHBIN} ${YETUS_ARGS[*]}"
144 /usr/bin/env bash "${TESTPATCHBIN}" "${YETUS_ARGS[@]}"