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: 10, 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.12.0'
41 GENERAL_CHECK_PLUGINS = 'all,-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/output/excludes"
50 SUREFIRE_FIRST_PART_FORK_COUNT = '0.5C'
51 SUREFIRE_SECOND_PART_FORK_COUNT = '0.5C'
52 // a global view of paths. parallel stages can land on the same host concurrently, so each
53 // stage works in its own subdirectory. there is an "output" under each of these
54 // directories, which we retrieve after the build is complete.
55 WORKDIR_REL_GENERAL_CHECK = 'yetus-general-check'
56 WORKDIR_REL_JDK8_HADOOP3_CHECK = 'yetus-jdk8-hadoop3-check'
57 WORKDIR_REL_JDK11_HADOOP3_CHECK = 'yetus-jdk11-hadoop3-check'
58 ASF_NIGHTLIES = 'https://nightlies.apache.org'
59 ASF_NIGHTLIES_BASE_ORI = "${ASF_NIGHTLIES}/hbase/${JOB_NAME}/${BUILD_NUMBER}"
60 ASF_NIGHTLIES_BASE = "${ASF_NIGHTLIES_BASE_ORI.replaceAll(' ', '%20')}"
64 booleanParam(name: 'DEBUG',
66 description: 'Print extra outputs for debugging the jenkins job and yetus')
70 stage ('precommit checks') {
72 stage ('yetus general check') {
79 // customized per parallel stage
80 PLUGINS = "${GENERAL_CHECK_PLUGINS}"
81 SET_JAVA_HOME = '/usr/lib/jvm/java-8'
82 WORKDIR_REL = "${WORKDIR_REL_GENERAL_CHECK}"
83 // identical for all parallel stages
84 WORKDIR = "${WORKSPACE}/${WORKDIR_REL}"
85 YETUSDIR = "${WORKDIR}/${YETUS_REL}"
86 SOURCEDIR = "${WORKDIR}/${SRC_REL}"
87 PATCHDIR = "${WORKDIR}/${PATCH_REL}"
88 BUILD_URL_ARTIFACTS = "artifact/${WORKDIR_REL}/${PATCH_REL}"
89 DOCKERFILE = "${WORKDIR}/${DOCKERFILE_REL}"
90 YETUS_DRIVER = "${WORKDIR}/${YETUS_DRIVER_REL}"
91 ASF_NIGHTLIES_GENERAL_CHECK_BASE="${ASF_NIGHTLIES_BASE}/${WORKDIR_REL}/${PATCH_REL}"
100 branches : [[name: "${YETUS_VERSION}"]],
101 userRemoteConfigs: [[url: 'https://github.com/apache/yetus.git']]]
107 credentialsId: 'apache-hbase-at-github.com',
108 passwordVariable: 'GITHUB_PASSWORD',
109 usernameVariable: 'GITHUB_USER'
115 script: '''#!/bin/bash -e
116 hostname -a ; pwd ; ls -la
118 echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
123 // mark the build as UNSTABLE instead of FAILURE, to avoid skipping the later publish of
124 // test output. See HBASE-26339 for more details.
125 currentBuild.result = 'UNSTABLE'
133 sshPublisher(publishers: [
134 sshPublisherDesc(configName: 'Nightlies',
136 sshTransfer(remoteDirectory: "hbase/${JOB_NAME}/${BUILD_NUMBER}",
137 sourceFiles: "${env.WORKDIR_REL}/${env.PATCH_REL}/*-site/*,${env.WORKDIR_REL}/${env.PATCH_REL}/*-site/**/*"
143 if [ -d "${PATCHDIR}/branch-site" ]; then
144 echo "Remove ${PATCHDIR}/branch-site for saving space"
145 rm -rf "${PATCHDIR}/branch-site"
146 python2 ${SOURCEDIR}/dev-support/gen_redirect_html.py "${ASF_NIGHTLIES_GENERAL_CHECK_BASE}/branch-site" > "${PATCHDIR}/branch-site.html"
148 echo "No branch-site, skipping"
150 if [ -d "${PATCHDIR}/patch-site" ]; then
151 echo "Remove ${PATCHDIR}/patch-site for saving space"
152 rm -rf "${PATCHDIR}/patch-site"
153 python2 ${SOURCEDIR}/dev-support/gen_redirect_html.py "${ASF_NIGHTLIES_GENERAL_CHECK_BASE}/patch-site" > "${PATCHDIR}/patch-site.html"
155 echo "No patch-site, skipping"
158 // Has to be relative to WORKSPACE.
159 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/*"
160 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/**/*"
161 publishHTML target: [
164 alwaysLinkToLastBuild: true,
165 // Has to be relative to WORKSPACE
166 reportDir: "${WORKDIR_REL}/${PATCH_REL}",
167 reportFiles: 'report.html',
168 reportName: 'PR General Check Report'
171 // Jenkins pipeline jobs fill slaves on PRs without this :(
174 sh label: 'Cleanup workspace', script: '''#!/bin/bash -e
176 if [ -f "${PATCHDIR}/pidfile.txt" ]; then
177 echo "test-patch process appears to still be running: killing"
178 kill `cat "${PATCHDIR}/pidfile.txt"` || true
181 if [ -f "${PATCHDIR}/cidfile.txt" ]; then
182 echo "test-patch container appears to still be running: killing"
183 docker kill `cat "${PATCHDIR}/cidfile.txt"` || true
186 chmod -R u+rxw "${WORKSPACE}"
195 stage ('yetus jdk8 Hadoop3 checks') {
202 // customized per parallel stage
203 PLUGINS = "${JDK_SPECIFIC_PLUGINS}"
204 SET_JAVA_HOME = '/usr/lib/jvm/java-8'
205 WORKDIR_REL = "${WORKDIR_REL_JDK8_HADOOP3_CHECK}"
206 // identical for all parallel stages
207 WORKDIR = "${WORKSPACE}/${WORKDIR_REL}"
208 YETUSDIR = "${WORKDIR}/${YETUS_REL}"
209 SOURCEDIR = "${WORKDIR}/${SRC_REL}"
210 PATCHDIR = "${WORKDIR}/${PATCH_REL}"
211 BUILD_URL_ARTIFACTS = "artifact/${WORKDIR_REL}/${PATCH_REL}"
212 DOCKERFILE = "${WORKDIR}/${DOCKERFILE_REL}"
213 YETUS_DRIVER = "${WORKDIR}/${YETUS_DRIVER_REL}"
214 SKIP_ERRORPRONE = true
217 dir("${SOURCEDIR}") {
223 branches : [[name: "${YETUS_VERSION}"]],
224 userRemoteConfigs: [[url: 'https://github.com/apache/yetus.git']]]
230 credentialsId: 'apache-hbase-at-github.com',
231 passwordVariable: 'GITHUB_PASSWORD',
232 usernameVariable: 'GITHUB_USER'
238 script: '''#!/bin/bash -e
239 hostname -a ; pwd ; ls -la
241 echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
246 // mark the build as UNSTABLE instead of FAILURE, to avoid skipping the later publish of
247 // test output. See HBASE-26339 for more details.
248 currentBuild.result = 'UNSTABLE'
256 junit testResults: "${WORKDIR_REL}/${SRC_REL}/**/target/**/TEST-*.xml",
257 allowEmptyResults: true, skipPublishingChecks: true
258 sh label: 'zip surefire reports', script: '''#!/bin/bash -e
259 if [ -d "${PATCHDIR}/archiver" ]; then
260 count=$(find "${PATCHDIR}/archiver" -type f | wc -l)
261 if [[ 0 -ne ${count} ]]; then
262 echo "zipping ${count} archived files"
263 zip -q -m -r "${PATCHDIR}/test_logs.zip" "${PATCHDIR}/archiver"
265 echo "No archived files, skipping compressing."
268 echo "No archiver directory, skipping compressing."
271 sshPublisher(publishers: [
272 sshPublisherDesc(configName: 'Nightlies',
274 sshTransfer(remoteDirectory: "hbase/${JOB_NAME}/${BUILD_NUMBER}",
275 sourceFiles: "${env.WORKDIR_REL}/${env.PATCH_REL}/test_logs.zip"
280 // remove the big test logs zip file, store the nightlies url in test_logs.txt
282 if [ -f "${PATCHDIR}/test_logs.zip" ]; then
283 echo "Remove ${PATCHDIR}/test_logs.zip for saving space"
284 rm -rf "${PATCHDIR}/test_logs.zip"
285 python2 ${SOURCEDIR}/dev-support/gen_redirect_html.py "${ASF_NIGHTLIES_BASE}/${WORKDIR_REL}/${PATCH_REL}" > "${PATCHDIR}/test_logs.html"
287 echo "No test_logs.zip, skipping"
290 // Has to be relative to WORKSPACE.
291 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit"
292 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/**/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit/**/*"
293 publishHTML target: [
296 alwaysLinkToLastBuild: true,
297 // Has to be relative to WORKSPACE
298 reportDir: "${WORKDIR_REL}/${PATCH_REL}",
299 reportFiles: 'report.html',
300 reportName: 'PR JDK8 Hadoop3 Check Report'
303 // Jenkins pipeline jobs fill slaves on PRs without this :(
306 sh label: 'Cleanup workspace', script: '''#!/bin/bash -e
308 if [ -f "${PATCHDIR}/pidfile.txt" ]; then
309 echo "test-patch process appears to still be running: killing"
310 kill `cat "${PATCHDIR}/pidfile.txt"` || true
313 if [ -f "${PATCHDIR}/cidfile.txt" ]; then
314 echo "test-patch container appears to still be running: killing"
315 docker kill `cat "${PATCHDIR}/cidfile.txt"` || true
318 chmod -R u+rxw "${WORKSPACE}"
327 stage ('yetus jdk11 hadoop3 checks') {
334 // customized per parallel stage
335 PLUGINS = "${JDK_SPECIFIC_PLUGINS}"
336 SET_JAVA_HOME = '/usr/lib/jvm/java-11'
337 WORKDIR_REL = "${WORKDIR_REL_JDK11_HADOOP3_CHECK}"
338 // identical for all parallel stages
339 WORKDIR = "${WORKSPACE}/${WORKDIR_REL}"
340 YETUSDIR = "${WORKDIR}/${YETUS_REL}"
341 SOURCEDIR = "${WORKDIR}/${SRC_REL}"
342 PATCHDIR = "${WORKDIR}/${PATCH_REL}"
343 BUILD_URL_ARTIFACTS = "artifact/${WORKDIR_REL}/${PATCH_REL}"
344 DOCKERFILE = "${WORKDIR}/${DOCKERFILE_REL}"
345 YETUS_DRIVER = "${WORKDIR}/${YETUS_DRIVER_REL}"
346 SKIP_ERRORPRONE = true
349 dir("${SOURCEDIR}") {
355 branches : [[name: "${YETUS_VERSION}"]],
356 userRemoteConfigs: [[url: 'https://github.com/apache/yetus.git']]]
362 credentialsId: 'apache-hbase-at-github.com',
363 passwordVariable: 'GITHUB_PASSWORD',
364 usernameVariable: 'GITHUB_USER'
370 script: '''#!/bin/bash -e
371 hostname -a ; pwd ; ls -la
373 echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
378 // mark the build as UNSTABLE instead of FAILURE, to avoid skipping the later publish of
379 // test output. See HBASE-26339 for more details.
380 currentBuild.result = 'UNSTABLE'
388 junit testResults: "${WORKDIR_REL}/${SRC_REL}/**/target/**/TEST-*.xml",
389 allowEmptyResults: true, skipPublishingChecks: true
390 sh label: 'zip surefire reports', script: '''#!/bin/bash -e
391 if [ -d "${PATCHDIR}/archiver" ]; then
392 count=$(find "${PATCHDIR}/archiver" -type f | wc -l)
393 if [[ 0 -ne ${count} ]]; then
394 echo "zipping ${count} archived files"
395 zip -q -m -r "${PATCHDIR}/test_logs.zip" "${PATCHDIR}/archiver"
397 echo "No archived files, skipping compressing."
400 echo "No archiver directory, skipping compressing."
403 sshPublisher(publishers: [
404 sshPublisherDesc(configName: 'Nightlies',
406 sshTransfer(remoteDirectory: "hbase/${JOB_NAME}/${BUILD_NUMBER}",
407 sourceFiles: "${env.WORKDIR_REL}/${env.PATCH_REL}/test_logs.zip"
412 // remove the big test logs zip file, store the nightlies url in test_logs.txt
414 if [ -f "${PATCHDIR}/test_logs.zip" ]; then
415 echo "Remove ${PATCHDIR}/test_logs.zip for saving space"
416 rm -rf "${PATCHDIR}/test_logs.zip"
417 python2 ${SOURCEDIR}/dev-support/gen_redirect_html.py "${ASF_NIGHTLIES_BASE}/${WORKDIR_REL}/${PATCH_REL}" > "${PATCHDIR}/test_logs.html"
419 echo "No test_logs.zip, skipping"
422 // Has to be relative to WORKSPACE.
423 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit"
424 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/**/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit/**/*"
425 publishHTML target: [
428 alwaysLinkToLastBuild: true,
429 // Has to be relative to WORKSPACE
430 reportDir: "${WORKDIR_REL}/${PATCH_REL}",
431 reportFiles: 'report.html',
432 reportName: 'PR JDK11 Hadoop3 Check Report'
435 // Jenkins pipeline jobs fill slaves on PRs without this :(
438 sh label: 'Cleanup workspace', script: '''#!/bin/bash -e
440 if [ -f "${PATCHDIR}/pidfile.txt" ]; then
441 echo "test-patch process appears to still be running: killing"
442 kill `cat "${PATCHDIR}/pidfile.txt"` || true
445 if [ -f "${PATCHDIR}/cidfile.txt" ]; then
446 echo "test-patch container appears to still be running: killing"
447 docker kill `cat "${PATCHDIR}/cidfile.txt"` || true
450 chmod -R u+rxw "${WORKSPACE}"
464 // Jenkins pipeline jobs fill slaves on PRs without this :(
467 sh label: 'Cleanup workspace', script: '''#!/bin/bash -e
469 chmod -R u+rxw "${WORKSPACE}"