1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
25 // N.B. this is per-branch, which means per PR
26 disableConcurrentBuilds()
27 buildDiscarder(logRotator(numToKeepStr: '15'))
28 timeout (time: 7, unit: 'HOURS')
37 DOCKERFILE_REL = "${SRC_REL}/dev-support/docker/Dockerfile"
38 YETUS_DRIVER_REL = "${SRC_REL}/dev-support/jenkins_precommit_github_yetus.sh"
39 // Branch or tag name. Yetus release tags are 'rel/X.Y.Z'
40 YETUS_VERSION = 'rel/0.11.1'
41 GENERAL_CHECK_PLUGINS = 'all,-compile,-javac,-javadoc,-jira,-shadedjars,-unit'
42 JDK_SPECIFIC_PLUGINS = 'compile,github,htmlout,javac,javadoc,maven,mvninstall,shadedjars,unit'
43 // output from surefire; sadly the archive function in yetus only works on file names.
44 ARCHIVE_PATTERN_LIST = 'TEST-*.xml,org.apache.h*.txt,*.dumpstream,*.dump'
45 // These tests currently have known failures. Once they burn down to 0, remove from here so that new problems will cause a failure.
46 TESTS_FILTER = 'cc,checkstyle,javac,javadoc,pylint,shellcheck,whitespace,perlcritic,ruby-lint,rubocop,mvnsite'
47 EXCLUDE_TESTS_URL = "${JENKINS_URL}/job/HBase-Find-Flaky-Tests/job/${CHANGE_TARGET}/lastSuccessfulBuild/artifact/excludes"
49 // a global view of paths. parallel stages can land on the same host concurrently, so each
50 // stage works in its own subdirectory. there is an "output" under each of these
51 // directories, which we retrieve after the build is complete.
52 WORKDIR_REL_GENERAL_CHECK = 'yetus-general-check'
53 WORKDIR_REL_JDK8_HADOOP3_CHECK = 'yetus-jdk8-hadoop3-check'
54 WORKDIR_REL_JDK11_HADOOP3_CHECK = 'yetus-jdk11-hadoop3-check'
58 booleanParam(name: 'DEBUG',
60 description: 'Print extra outputs for debugging the jenkins job and yetus')
64 stage ('precommit checks') {
66 stage ('yetus general check') {
73 // customized per parallel stage
74 PLUGINS = "${GENERAL_CHECK_PLUGINS}"
75 SET_JAVA_HOME = '/usr/lib/jvm/java-8'
76 WORKDIR_REL = "${WORKDIR_REL_GENERAL_CHECK}"
77 // identical for all parallel stages
78 WORKDIR = "${WORKSPACE}/${WORKDIR_REL}"
79 YETUSDIR = "${WORKDIR}/${YETUS_REL}"
80 SOURCEDIR = "${WORKDIR}/${SRC_REL}"
81 PATCHDIR = "${WORKDIR}/${PATCH_REL}"
82 BUILD_URL_ARTIFACTS = "artifact/${WORKDIR_REL}/${PATCH_REL}"
83 DOCKERFILE = "${WORKDIR}/${DOCKERFILE_REL}"
84 YETUS_DRIVER = "${WORKDIR}/${YETUS_DRIVER_REL}"
93 branches : [[name: "${YETUS_VERSION}"]],
94 userRemoteConfigs: [[url: 'https://github.com/apache/yetus.git']]]
100 credentialsId: 'apache-hbase-at-github.com',
101 passwordVariable: 'GITHUB_PASSWORD',
102 usernameVariable: 'GITHUB_USER'
104 sh label: 'test-patch', script: '''
105 hostname -a ; pwd ; ls -la
107 echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
115 // Has to be relative to WORKSPACE.
116 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit"
117 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/**/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit/**/*"
118 publishHTML target: [
121 alwaysLinkToLastBuild: true,
122 // Has to be relative to WORKSPACE
123 reportDir: "${WORKDIR_REL}/${PATCH_REL}",
124 reportFiles: 'report.html',
125 reportName: 'PR General Check Report'
128 // Jenkins pipeline jobs fill slaves on PRs without this :(
131 sh label: 'Cleanup workspace', script: '''
133 if [ -f "${PATCHDIR}/pidfile.txt" ]; then
134 echo "test-patch process appears to still be running: killing"
135 kill `cat "${PATCHDIR}/pidfile.txt"` || true
138 if [ -f "${PATCHDIR}/cidfile.txt" ]; then
139 echo "test-patch container appears to still be running: killing"
140 docker kill `cat "${PATCHDIR}/cidfile.txt"` || true
143 chmod -R u+rxw "${WORKSPACE}"
152 stage ('yetus jdk8 Hadoop3 checks') {
159 // customized per parallel stage
160 PLUGINS = "${JDK_SPECIFIC_PLUGINS}"
161 SET_JAVA_HOME = '/usr/lib/jvm/java-8'
162 WORKDIR_REL = "${WORKDIR_REL_JDK8_HADOOP3_CHECK}"
163 // identical for all parallel stages
164 WORKDIR = "${WORKSPACE}/${WORKDIR_REL}"
165 YETUSDIR = "${WORKDIR}/${YETUS_REL}"
166 SOURCEDIR = "${WORKDIR}/${SRC_REL}"
167 PATCHDIR = "${WORKDIR}/${PATCH_REL}"
168 BUILD_URL_ARTIFACTS = "artifact/${WORKDIR_REL}/${PATCH_REL}"
169 DOCKERFILE = "${WORKDIR}/${DOCKERFILE_REL}"
170 YETUS_DRIVER = "${WORKDIR}/${YETUS_DRIVER_REL}"
173 dir("${SOURCEDIR}") {
179 branches : [[name: "${YETUS_VERSION}"]],
180 userRemoteConfigs: [[url: 'https://github.com/apache/yetus.git']]]
186 credentialsId: 'apache-hbase-at-github.com',
187 passwordVariable: 'GITHUB_PASSWORD',
188 usernameVariable: 'GITHUB_USER'
190 sh label: 'test-patch', script: '''
191 hostname -a ; pwd ; ls -la
193 echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
201 junit testResults: "${WORKDIR_REL}/${SRC_REL}/**/target/**/TEST-*.xml", allowEmptyResults: true
202 sh label: 'zip surefire reports', script: '''
203 if [ -d "${PATCHDIR}/archiver" ]; then
204 count=$(find "${PATCHDIR}/archiver" -type f | wc -l)
205 if [[ 0 -ne ${count} ]]; then
206 echo "zipping ${count} archived files"
207 zip -q -m -r "${PATCHDIR}/test_logs.zip" "${PATCHDIR}/archiver"
209 echo "No archived files, skipping compressing."
212 echo "No archiver directory, skipping compressing."
215 // Has to be relative to WORKSPACE.
216 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit"
217 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/**/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit/**/*"
218 publishHTML target: [
221 alwaysLinkToLastBuild: true,
222 // Has to be relative to WORKSPACE
223 reportDir: "${WORKDIR_REL}/${PATCH_REL}",
224 reportFiles: 'report.html',
225 reportName: 'PR JDK8 Hadoop2 Check Report'
228 // Jenkins pipeline jobs fill slaves on PRs without this :(
231 sh label: 'Cleanup workspace', script: '''
233 if [ -f "${PATCHDIR}/pidfile.txt" ]; then
234 echo "test-patch process appears to still be running: killing"
235 kill `cat "${PATCHDIR}/pidfile.txt"` || true
238 if [ -f "${PATCHDIR}/cidfile.txt" ]; then
239 echo "test-patch container appears to still be running: killing"
240 docker kill `cat "${PATCHDIR}/cidfile.txt"` || true
243 chmod -R u+rxw "${WORKSPACE}"
252 stage ('yetus jdk11 hadoop3 checks') {
259 // customized per parallel stage
260 PLUGINS = "${JDK_SPECIFIC_PLUGINS}"
261 SET_JAVA_HOME = '/usr/lib/jvm/java-11'
262 WORKDIR_REL = "${WORKDIR_REL_JDK11_HADOOP3_CHECK}"
263 // identical for all parallel stages
264 WORKDIR = "${WORKSPACE}/${WORKDIR_REL}"
265 YETUSDIR = "${WORKDIR}/${YETUS_REL}"
266 SOURCEDIR = "${WORKDIR}/${SRC_REL}"
267 PATCHDIR = "${WORKDIR}/${PATCH_REL}"
268 BUILD_URL_ARTIFACTS = "artifact/${WORKDIR_REL}/${PATCH_REL}"
269 DOCKERFILE = "${WORKDIR}/${DOCKERFILE_REL}"
270 YETUS_DRIVER = "${WORKDIR}/${YETUS_DRIVER_REL}"
273 dir("${SOURCEDIR}") {
279 branches : [[name: "${YETUS_VERSION}"]],
280 userRemoteConfigs: [[url: 'https://github.com/apache/yetus.git']]]
286 credentialsId: 'apache-hbase-at-github.com',
287 passwordVariable: 'GITHUB_PASSWORD',
288 usernameVariable: 'GITHUB_USER'
290 sh label: 'test-patch', script: '''
291 hostname -a ; pwd ; ls -la
293 echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
301 junit testResults: "${WORKDIR_REL}/${SRC_REL}/**/target/**/TEST-*.xml", allowEmptyResults: true
302 sh label: 'zip surefire reports', script: '''
303 if [ -d "${PATCHDIR}/archiver" ]; then
304 count=$(find "${PATCHDIR}/archiver" -type f | wc -l)
305 if [[ 0 -ne ${count} ]]; then
306 echo "zipping ${count} archived files"
307 zip -q -m -r "${PATCHDIR}/test_logs.zip" "${PATCHDIR}/archiver"
309 echo "No archived files, skipping compressing."
312 echo "No archiver directory, skipping compressing."
315 // Has to be relative to WORKSPACE.
316 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit"
317 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/**/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit/**/*"
318 publishHTML target: [
321 alwaysLinkToLastBuild: true,
322 // Has to be relative to WORKSPACE
323 reportDir: "${WORKDIR_REL}/${PATCH_REL}",
324 reportFiles: 'report.html',
325 reportName: 'PR JDK11 Hadoop3 Check Report'
328 // Jenkins pipeline jobs fill slaves on PRs without this :(
331 sh label: 'Cleanup workspace', script: '''
333 if [ -f "${PATCHDIR}/pidfile.txt" ]; then
334 echo "test-patch process appears to still be running: killing"
335 kill `cat "${PATCHDIR}/pidfile.txt"` || true
338 if [ -f "${PATCHDIR}/cidfile.txt" ]; then
339 echo "test-patch container appears to still be running: killing"
340 docker kill `cat "${PATCHDIR}/cidfile.txt"` || true
343 chmod -R u+rxw "${WORKSPACE}"
357 // Jenkins pipeline jobs fill slaves on PRs without this :(
360 sh label: 'Cleanup workspace', script: '''
362 chmod -R u+rxw "${WORKSPACE}"