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
27 buildDiscarder(logRotator(numToKeepStr: '30'))
28 timeout (time: 6, unit: 'HOURS')
33 TOOLS = "${env.WORKSPACE}/tools"
34 // where we check out to across stages
35 BASEDIR = "${env.WORKSPACE}/component"
36 YETUS_RELEASE = '0.6.0'
37 // where we'll write everything from different steps.
38 OUTPUT_RELATIVE_GENERAL = 'output-general'
39 OUTPUTDIR_GENERAL = "${env.WORKSPACE}/output-general"
40 OUTPUT_RELATIVE_JDK7 = 'output-jdk7'
41 OUTPUTDIR_JDK7 = "${env.WORKSPACE}/output-jdk7"
42 OUTPUT_RELATIVE_JDK8 = 'output-jdk8'
43 OUTPUTDIR_JDK8 = "${env.WORKSPACE}/output-jdk8"
45 PROJET_PERSONALITY = 'https://raw.githubusercontent.com/apache/hbase/master/dev-support/hbase-personality.sh'
46 // This section of the docs tells folks not to use the javadoc tag. older branches have our old version of the check for said tag.
47 AUTHOR_IGNORE_LIST = 'src/main/asciidoc/_chapters/developer.adoc,dev-support/test-patch.sh'
48 WHITESPACE_IGNORE_LIST = '.*/generated/.*'
49 // output from surefire; sadly the archive function in yetus only works on file names.
50 ARCHIVE_PATTERN_LIST = 'TEST-*.xml,org.apache.h*.txt'
51 // These tests currently have known failures. Once they burn down to 0, remove from here so that new problems will cause a failure.
52 TESTS_FILTER = 'cc,checkstyle,javac,javadoc,pylint,shellcheck,whitespace,perlcritic,ruby-lint,rubocop,mvnsite'
53 BRANCH_SPECIFIC_DOCKERFILE = "${env.BASEDIR}/dev-support/docker/Dockerfile"
54 EXCLUDE_TESTS_URL = 'https://builds.apache.org/job/HBase-Find-Flaky-Tests/lastSuccessfulBuild/artifact/excludes/'
57 booleanParam(name: 'USE_YETUS_PRERELEASE', defaultValue: false, description: '''Check to use the current HEAD of apache/yetus rather than our configured release.
59 Should only be used manually when e.g. there is some non-work-aroundable issue in yetus we are checking a fix for.''')
60 booleanParam(name: 'DEBUG', defaultValue: false, description: 'Produce a lot more meta-information.')
63 stage ('scm checkout') {
70 stage ('yetus install') {
72 sh '''#!/usr/bin/env bash
73 echo "Ensure we have a copy of Apache Yetus."
74 if [[ true != "${USE_YETUS_PRERELEASE}" ]]; then
75 YETUS_DIR="${WORKSPACE}/yetus-${YETUS_RELEASE}"
76 echo "Checking for Yetus ${YETUS_RELEASE} in '${YETUS_DIR}'"
77 if [ ! -d "${YETUS_DIR}" ]; then
78 echo "New download of Apache Yetus version ${YETUS_RELEASE}."
79 rm -rf "${WORKSPACE}/.gpg"
80 mkdir -p "${WORKSPACE}/.gpg"
81 chmod -R 700 "${WORKSPACE}/.gpg"
83 echo "install yetus project KEYS"
84 curl -L --fail -o "${WORKSPACE}/KEYS_YETUS" https://dist.apache.org/repos/dist/release/yetus/KEYS
85 gpg --homedir "${WORKSPACE}/.gpg" --import "${WORKSPACE}/KEYS_YETUS"
87 echo "download yetus release ${YETUS_RELEASE}"
88 curl -L --fail -O "https://dist.apache.org/repos/dist/release/yetus/${YETUS_RELEASE}/yetus-${YETUS_RELEASE}-bin.tar.gz"
89 curl -L --fail -O "https://dist.apache.org/repos/dist/release/yetus/${YETUS_RELEASE}/yetus-${YETUS_RELEASE}-bin.tar.gz.asc"
90 echo "verifying yetus release"
91 gpg --homedir "${WORKSPACE}/.gpg" --verify "yetus-${YETUS_RELEASE}-bin.tar.gz.asc"
92 mv "yetus-${YETUS_RELEASE}-bin.tar.gz" yetus.tar.gz
94 echo "Reusing cached download of Apache Yetus version ${YETUS_RELEASE}."
97 YETUS_DIR="${WORKSPACE}/yetus-git"
99 echo "downloading from github"
100 curl -L --fail https://api.github.com/repos/apache/yetus/tarball/HEAD -o yetus.tar.gz
102 if [ ! -d "${YETUS_DIR}" ]; then
103 echo "unpacking yetus into '${YETUS_DIR}'"
104 mkdir -p "${YETUS_DIR}"
105 gunzip -c yetus.tar.gz | tar xpf - -C "${YETUS_DIR}" --strip-components 1
108 dir ("${env.TOOLS}") {
109 sh """#!/usr/bin/env bash
110 echo "Downloading Project personality."
111 curl -L -o personality.sh "${env.PROJET_PERSONALITY}"
114 stash name: 'yetus', includes: "yetus-*/*,yetus-*/**/*,tools/personality.sh"
117 stage ('yetus general check') {
119 // TODO does hadoopcheck need to be jdk specific?
120 // Should be things that work with multijdk
121 TESTS = 'all,-unit,-findbugs'
122 // on branches that don't support jdk7, this will already be JAVA_HOME, so we'll end up not
123 // doing multijdk there.
124 MULTIJDK = '/usr/lib/jvm/java-8-openjdk-amd64'
125 OUTPUT_RELATIVE = "${env.OUTPUT_RELATIVE_GENERAL}"
126 OUTPUTDIR = "${env.OUTPUTDIR_GENERAL}"
130 // TODO should this be a download from master, similar to how the personality is?
131 sh "${env.BASEDIR}/dev-support/hbase_nightly_yetus.sh"
135 // env variables don't work in archive? or this has to be relative to WORKSPACE. :(
136 archive 'output-general/*'
137 archive 'output-general/**/*'
138 publishHTML target: [
141 alwaysLinkToLastBuild: true,
142 // has to be relative to WORKSPACE :(
143 reportDir: 'output-general',
144 reportFiles: 'console-report.html',
145 reportName: 'General Nightly Build Report'
150 stage ('yetus jdk7 checks') {
155 TESTS = 'mvninstall,compile,javac,unit,htmlout'
156 OUTPUT_RELATIVE = "${env.OUTPUT_RELATIVE_JDK7}"
157 OUTPUTDIR = "${env.OUTPUTDIR_JDK7}"
158 // On branches where we do jdk7 checks, jdk7 will be JAVA_HOME already.
162 sh """#!/usr/bin/env bash
163 # for branch-1.1 we don't do jdk8 findbugs, so do it here
164 if [ "${env.BRANCH_NAME}" == "branch-1.1" ]; then
167 "${env.BASEDIR}/dev-support/hbase_nightly_yetus.sh"
172 junit testResults: 'output-jdk7/**/target/**/TEST-*.xml', allowEmptyResults: true
173 // zip surefire reports.
175 if [ -d "${OUTPUTDIR}/archiver" ]; then
176 count=$(find "${OUTPUTDIR}/archiver" -type f | wc -l)
177 if [[ 0 -ne ${count} ]]; then
178 echo "zipping ${count} archived files"
179 zip -q -m -r "${OUTPUTDIR}/test_logs.zip" "${OUTPUTDIR}/archiver"
181 echo "No archived files, skipping compressing."
184 echo "No archiver directory, skipping compressing."
187 // env variables don't work in archive? or this has to be relative to WORKSPACE. :(
188 archive 'output-jdk7/*'
189 archive 'output-jdk7/**/*'
190 publishHTML target: [
193 alwaysLinkToLastBuild: true,
194 // has to be relative to WORKSPACE :(
195 reportDir: 'output-jdk7',
196 reportFiles: 'console-report.html',
197 reportName: 'JDK7 Nightly Build Report'
202 stage ('yetus jdk8 checks') {
209 TESTS = 'mvninstall,compile,javac,unit,findbugs,htmlout'
210 OUTPUT_RELATIVE = "${env.OUTPUT_RELATIVE_JDK8}"
211 OUTPUTDIR = "${env.OUTPUTDIR_JDK8}"
212 // This isn't strictly needed on branches that only support jdk8, but doesn't hurt
213 // and is needed on branches that do both jdk7 and jdk8
214 SET_JAVA_HOME = '/usr/lib/jvm/java-8-openjdk-amd64'
218 sh "${env.BASEDIR}/dev-support/hbase_nightly_yetus.sh"
222 junit testResults: 'output-jdk8/**/target/**/TEST-*.xml', allowEmptyResults: true
223 // zip surefire reports.
225 if [ -d "${OUTPUTDIR}/archiver" ]; then
226 count=$(find "${OUTPUTDIR}/archiver" -type f | wc -l)
227 if [[ 0 -ne ${count} ]]; then
228 echo "zipping ${count} archived files"
229 zip -q -m -r "${OUTPUTDIR}/test_logs.zip" "${OUTPUTDIR}/archiver"
231 echo "No archived files, skipping compressing."
234 echo "No archiver directory, skipping compressing."
237 // env variables don't work in archive? or this has to be relative to WORKSPACE. :(
238 archive 'output-jdk8/*'
239 archive 'output-jdk8/**/*'
240 publishHTML target: [
243 alwaysLinkToLastBuild: true,
244 // has to be relative to WORKSPACE :(
245 reportDir: 'output-jdk8',
246 reportFiles: 'console-report.html',
247 reportName: 'JDK8 Nightly Build Report'
252 // This is meant to mimic what a release manager will do to create RCs.
253 // See http://hbase.apache.org/book.html#maven.release
254 stage ('create source tarball') {
256 maven 'Maven (latest)'
257 // this needs to be set to the jdk that ought to be used to build releases on the branch the Jenkinsfile is stored in.
258 jdk "JDK 1.8 (latest)"
262 echo "Setting up directories"
263 rm -rf "output-srctarball" && mkdir "output-srctarball"
264 rm -rf "unpacked_src_tarball" && mkdir "unpacked_src_tarball"
265 rm -rf ".m2-for-repo" && mkdir ".m2-for-repo"
266 rm -rf ".m2-for-src" && mkdir ".m2-for-src"
269 ${env.BASEDIR}/dev-support/hbase_nightly_source-artifact.sh \
270 --intermediate-file-dir output-srctarball \
271 --unpack-temp-dir unpacked_src_tarball \
272 --maven-m2-initial .m2-for-repo \
273 --maven-m2-src-build .m2-for-src \
279 archive 'output-srctarball/*'