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/job/HBase-Find-Flaky-Tests/job/${CHANGE_TARGET}/lastSuccessfulBuild/artifact/output/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'
55 ASF_NIGHTLIES = 'https://nightlies.apache.org'
59 booleanParam(name: 'DEBUG',
61 description: 'Print extra outputs for debugging the jenkins job and yetus')
65 stage ('precommit checks') {
67 stage ('yetus general check') {
74 // customized per parallel stage
75 PLUGINS = "${GENERAL_CHECK_PLUGINS}"
76 SET_JAVA_HOME = '/usr/lib/jvm/java-8'
77 WORKDIR_REL = "${WORKDIR_REL_GENERAL_CHECK}"
78 // identical for all parallel stages
79 WORKDIR = "${WORKSPACE}/${WORKDIR_REL}"
80 YETUSDIR = "${WORKDIR}/${YETUS_REL}"
81 SOURCEDIR = "${WORKDIR}/${SRC_REL}"
82 PATCHDIR = "${WORKDIR}/${PATCH_REL}"
83 BUILD_URL_ARTIFACTS = "artifact/${WORKDIR_REL}/${PATCH_REL}"
84 DOCKERFILE = "${WORKDIR}/${DOCKERFILE_REL}"
85 YETUS_DRIVER = "${WORKDIR}/${YETUS_DRIVER_REL}"
94 branches : [[name: "${YETUS_VERSION}"]],
95 userRemoteConfigs: [[url: 'https://github.com/apache/yetus.git']]]
101 credentialsId: 'apache-hbase-at-github.com',
102 passwordVariable: 'GITHUB_PASSWORD',
103 usernameVariable: 'GITHUB_USER'
105 sh label: 'test-patch', script: '''#!/bin/bash -e
106 hostname -a ; pwd ; ls -la
108 echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
116 // Has to be relative to WORKSPACE.
117 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit"
118 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/**/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit/**/*"
119 publishHTML target: [
122 alwaysLinkToLastBuild: true,
123 // Has to be relative to WORKSPACE
124 reportDir: "${WORKDIR_REL}/${PATCH_REL}",
125 reportFiles: 'report.html',
126 reportName: 'PR General Check Report'
129 // Jenkins pipeline jobs fill slaves on PRs without this :(
132 sh label: 'Cleanup workspace', script: '''#!/bin/bash -e
134 if [ -f "${PATCHDIR}/pidfile.txt" ]; then
135 echo "test-patch process appears to still be running: killing"
136 kill `cat "${PATCHDIR}/pidfile.txt"` || true
139 if [ -f "${PATCHDIR}/cidfile.txt" ]; then
140 echo "test-patch container appears to still be running: killing"
141 docker kill `cat "${PATCHDIR}/cidfile.txt"` || true
144 chmod -R u+rxw "${WORKSPACE}"
153 stage ('yetus jdk8 Hadoop3 checks') {
160 // customized per parallel stage
161 PLUGINS = "${JDK_SPECIFIC_PLUGINS}"
162 SET_JAVA_HOME = '/usr/lib/jvm/java-8'
163 WORKDIR_REL = "${WORKDIR_REL_JDK8_HADOOP3_CHECK}"
164 // identical for all parallel stages
165 WORKDIR = "${WORKSPACE}/${WORKDIR_REL}"
166 YETUSDIR = "${WORKDIR}/${YETUS_REL}"
167 SOURCEDIR = "${WORKDIR}/${SRC_REL}"
168 PATCHDIR = "${WORKDIR}/${PATCH_REL}"
169 BUILD_URL_ARTIFACTS = "artifact/${WORKDIR_REL}/${PATCH_REL}"
170 DOCKERFILE = "${WORKDIR}/${DOCKERFILE_REL}"
171 YETUS_DRIVER = "${WORKDIR}/${YETUS_DRIVER_REL}"
172 SKIP_ERRORPRONE = true
175 dir("${SOURCEDIR}") {
181 branches : [[name: "${YETUS_VERSION}"]],
182 userRemoteConfigs: [[url: 'https://github.com/apache/yetus.git']]]
188 credentialsId: 'apache-hbase-at-github.com',
189 passwordVariable: 'GITHUB_PASSWORD',
190 usernameVariable: 'GITHUB_USER'
192 sh label: 'test-patch', script: '''#!/bin/bash -e
193 hostname -a ; pwd ; ls -la
195 echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
203 junit testResults: "${WORKDIR_REL}/${SRC_REL}/**/target/**/TEST-*.xml", allowEmptyResults: true
204 sh label: 'zip surefire reports', script: '''#!/bin/bash -e
205 if [ -d "${PATCHDIR}/archiver" ]; then
206 count=$(find "${PATCHDIR}/archiver" -type f | wc -l)
207 if [[ 0 -ne ${count} ]]; then
208 echo "zipping ${count} archived files"
209 zip -q -m -r "${PATCHDIR}/test_logs.zip" "${PATCHDIR}/archiver"
211 echo "No archived files, skipping compressing."
214 echo "No archiver directory, skipping compressing."
217 sshPublisher(publishers: [
218 sshPublisherDesc(configName: 'Nightlies',
220 sshTransfer(remoteDirectory: "hbase/${JOB_NAME}/${BUILD_NUMBER}",
221 sourceFiles: "${env.WORKDIR_REL}/${env.PATCH_REL}/test_logs.zip"
226 // remove the big test logs zip file, store the nightlies url in test_logs.txt
228 if [ -f "${PATCHDIR}/test_logs.zip" ]; then
229 echo "Remove ${PATCHDIR}/test_logs.zip for saving space"
230 rm -rf "${PATCHDIR}/test_logs.zip"
231 echo "${ASF_NIGHTLIES}/hbase/${JOB_NAME}/${BUILD_NUMBER}/${WORKDIR_REL}/${PATCH_REL}/test_logs.zip" > "${PATCHDIR}/test_logs.txt"
233 echo "No test_logs.zip, skipping"
236 // Has to be relative to WORKSPACE.
237 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit"
238 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/**/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit/**/*"
239 publishHTML target: [
242 alwaysLinkToLastBuild: true,
243 // Has to be relative to WORKSPACE
244 reportDir: "${WORKDIR_REL}/${PATCH_REL}",
245 reportFiles: 'report.html',
246 reportName: 'PR JDK8 Hadoop3 Check Report'
249 // Jenkins pipeline jobs fill slaves on PRs without this :(
252 sh label: 'Cleanup workspace', script: '''#!/bin/bash -e
254 if [ -f "${PATCHDIR}/pidfile.txt" ]; then
255 echo "test-patch process appears to still be running: killing"
256 kill `cat "${PATCHDIR}/pidfile.txt"` || true
259 if [ -f "${PATCHDIR}/cidfile.txt" ]; then
260 echo "test-patch container appears to still be running: killing"
261 docker kill `cat "${PATCHDIR}/cidfile.txt"` || true
264 chmod -R u+rxw "${WORKSPACE}"
273 stage ('yetus jdk11 hadoop3 checks') {
280 // customized per parallel stage
281 PLUGINS = "${JDK_SPECIFIC_PLUGINS}"
282 SET_JAVA_HOME = '/usr/lib/jvm/java-11'
283 WORKDIR_REL = "${WORKDIR_REL_JDK11_HADOOP3_CHECK}"
284 // identical for all parallel stages
285 WORKDIR = "${WORKSPACE}/${WORKDIR_REL}"
286 YETUSDIR = "${WORKDIR}/${YETUS_REL}"
287 SOURCEDIR = "${WORKDIR}/${SRC_REL}"
288 PATCHDIR = "${WORKDIR}/${PATCH_REL}"
289 BUILD_URL_ARTIFACTS = "artifact/${WORKDIR_REL}/${PATCH_REL}"
290 DOCKERFILE = "${WORKDIR}/${DOCKERFILE_REL}"
291 YETUS_DRIVER = "${WORKDIR}/${YETUS_DRIVER_REL}"
292 SKIP_ERRORPRONE = true
295 dir("${SOURCEDIR}") {
301 branches : [[name: "${YETUS_VERSION}"]],
302 userRemoteConfigs: [[url: 'https://github.com/apache/yetus.git']]]
308 credentialsId: 'apache-hbase-at-github.com',
309 passwordVariable: 'GITHUB_PASSWORD',
310 usernameVariable: 'GITHUB_USER'
312 sh label: 'test-patch', script: '''#!/bin/bash -e
313 hostname -a ; pwd ; ls -la
315 echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
323 junit testResults: "${WORKDIR_REL}/${SRC_REL}/**/target/**/TEST-*.xml", allowEmptyResults: true
324 sh label: 'zip surefire reports', script: '''#!/bin/bash -e
325 if [ -d "${PATCHDIR}/archiver" ]; then
326 count=$(find "${PATCHDIR}/archiver" -type f | wc -l)
327 if [[ 0 -ne ${count} ]]; then
328 echo "zipping ${count} archived files"
329 zip -q -m -r "${PATCHDIR}/test_logs.zip" "${PATCHDIR}/archiver"
331 echo "No archived files, skipping compressing."
334 echo "No archiver directory, skipping compressing."
337 sshPublisher(publishers: [
338 sshPublisherDesc(configName: 'Nightlies',
340 sshTransfer(remoteDirectory: "hbase/${JOB_NAME}/${BUILD_NUMBER}",
341 sourceFiles: "${env.WORKDIR_REL}/${env.PATCH_REL}/test_logs.zip"
346 // remove the big test logs zip file, store the nightlies url in test_logs.txt
348 if [ -f "${PATCHDIR}/test_logs.zip" ]; then
349 echo "Remove ${PATCHDIR}/test_logs.zip for saving space"
350 rm -rf "${PATCHDIR}/test_logs.zip"
351 echo "${ASF_NIGHTLIES}/hbase/${JOB_NAME}/${BUILD_NUMBER}/${WORKDIR_REL}/${PATCH_REL}/test_logs.zip" > "${PATCHDIR}/test_logs.txt"
353 echo "No test_logs.zip, skipping"
356 // Has to be relative to WORKSPACE.
357 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit"
358 archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/**/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit/**/*"
359 publishHTML target: [
362 alwaysLinkToLastBuild: true,
363 // Has to be relative to WORKSPACE
364 reportDir: "${WORKDIR_REL}/${PATCH_REL}",
365 reportFiles: 'report.html',
366 reportName: 'PR JDK11 Hadoop3 Check Report'
369 // Jenkins pipeline jobs fill slaves on PRs without this :(
372 sh label: 'Cleanup workspace', script: '''#!/bin/bash -e
374 if [ -f "${PATCHDIR}/pidfile.txt" ]; then
375 echo "test-patch process appears to still be running: killing"
376 kill `cat "${PATCHDIR}/pidfile.txt"` || true
379 if [ -f "${PATCHDIR}/cidfile.txt" ]; then
380 echo "test-patch container appears to still be running: killing"
381 docker kill `cat "${PATCHDIR}/cidfile.txt"` || true
384 chmod -R u+rxw "${WORKSPACE}"
398 // Jenkins pipeline jobs fill slaves on PRs without this :(
401 sh label: 'Cleanup workspace', script: '''#!/bin/bash -e
403 chmod -R u+rxw "${WORKSPACE}"