HBASE-22033 Update to maven-javadoc-plugin 3.2.0 and switch to non-forking aggregate...
[hbase.git] / dev-support / Jenkinsfile_GitHub
blob02eb46b4ff7ddd78221971cef780e2a540fb0515
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
8 //
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
16 // under the License.
18 pipeline {
20     agent {
21         label 'Hadoop'
22     }
24     options {
25         // N.B. this is per-branch, which means per PR
26         disableConcurrentBuilds()
27         buildDiscarder(logRotator(numToKeepStr: '15'))
28         timeout (time: 7, unit: 'HOURS')
29         timestamps()
30         skipDefaultCheckout()
31     }
33     environment {
34         SRC_REL = 'src'
35         PATCH_REL = 'output'
36         YETUS_REL = 'yetus'
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'
55     }
57     parameters {
58         booleanParam(name: 'DEBUG',
59                defaultValue: false,
60                description: 'Print extra outputs for debugging the jenkins job and yetus')
61     }
63     stages {
64         stage ('precommit checks') {
65             parallel {
66                 stage ('yetus general check') {
67                     agent {
68                         node {
69                             label 'Hadoop'
70                         }
71                     }
72                     environment {
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}"
85                     }
86                     steps {
87                         dir("${SOURCEDIR}") {
88                             checkout scm
89                         }
90                         dir("${YETUSDIR}") {
91                             checkout([
92                               $class           : 'GitSCM',
93                               branches         : [[name: "${YETUS_VERSION}"]],
94                               userRemoteConfigs: [[url: 'https://github.com/apache/yetus.git']]]
95                             )
96                         }
97                         dir("${WORKDIR}") {
98                             withCredentials([
99                                 usernamePassword(
100                                   credentialsId: 'apache-hbase-at-github.com',
101                                   passwordVariable: 'GITHUB_PASSWORD',
102                                   usernameVariable: 'GITHUB_USER'
103                                 )]) {
104                                 sh label: 'test-patch', script: '''
105                                     hostname -a ; pwd ; ls -la
106                                     printenv 2>&1 | sort
107                                     echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
108                                     "${YETUS_DRIVER}"
109                                 '''
110                             }
111                         }
112                     }
113                     post {
114                         always {
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: [
119                               allowMissing: true,
120                               keepAll: true,
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'
126                             ]
127                         }
128                         // Jenkins pipeline jobs fill slaves on PRs without this :(
129                         cleanup() {
130                             script {
131                                 sh label: 'Cleanup workspace', script: '''
132                                     # See YETUS-764
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
136                                       sleep 10
137                                     fi
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
141                                     fi
142                                     # See HADOOP-13951
143                                     chmod -R u+rxw "${WORKSPACE}"
144                                 '''
145                                 dir ("${WORKDIR}") {
146                                     deleteDir()
147                                 }
148                             }
149                         }
150                     }
151                 }
152                 stage ('yetus jdk8 Hadoop3 checks') {
153                     agent {
154                         node {
155                             label 'Hadoop'
156                         }
157                     }
158                     environment {
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}"
171                     }
172                     steps {
173                         dir("${SOURCEDIR}") {
174                             checkout scm
175                         }
176                         dir("${YETUSDIR}") {
177                             checkout([
178                               $class           : 'GitSCM',
179                               branches         : [[name: "${YETUS_VERSION}"]],
180                               userRemoteConfigs: [[url: 'https://github.com/apache/yetus.git']]]
181                             )
182                         }
183                         dir("${WORKDIR}") {
184                             withCredentials([
185                               usernamePassword(
186                                 credentialsId: 'apache-hbase-at-github.com',
187                                 passwordVariable: 'GITHUB_PASSWORD',
188                                 usernameVariable: 'GITHUB_USER'
189                               )]) {
190                                 sh label: 'test-patch', script: '''
191                                     hostname -a ; pwd ; ls -la
192                                     printenv 2>&1 | sort
193                                     echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
194                                     "${YETUS_DRIVER}"
195                                 '''
196                             }
197                         }
198                     }
199                     post {
200                         always {
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"
208                                   else
209                                     echo "No archived files, skipping compressing."
210                                   fi
211                                 else
212                                   echo "No archiver directory, skipping compressing."
213                                 fi
214                             '''
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: [
219                               allowMissing: true,
220                               keepAll: true,
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'
226                             ]
227                         }
228                         // Jenkins pipeline jobs fill slaves on PRs without this :(
229                         cleanup() {
230                             script {
231                                 sh label: 'Cleanup workspace', script: '''
232                                     # See YETUS-764
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
236                                       sleep 10
237                                     fi
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
241                                     fi
242                                     # See HADOOP-13951
243                                     chmod -R u+rxw "${WORKSPACE}"
244                                 '''
245                                 dir ("${WORKDIR}") {
246                                     deleteDir()
247                                 }
248                             }
249                         }
250                     }
251                 }
252                 stage ('yetus jdk11 hadoop3 checks') {
253                     agent {
254                         node {
255                             label 'Hadoop'
256                         }
257                     }
258                     environment {
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}"
271                     }
272                     steps {
273                         dir("${SOURCEDIR}") {
274                             checkout scm
275                         }
276                         dir("${YETUSDIR}") {
277                             checkout([
278                               $class           : 'GitSCM',
279                               branches         : [[name: "${YETUS_VERSION}"]],
280                               userRemoteConfigs: [[url: 'https://github.com/apache/yetus.git']]]
281                             )
282                         }
283                         dir("${WORKDIR}") {
284                             withCredentials([
285                               usernamePassword(
286                                 credentialsId: 'apache-hbase-at-github.com',
287                                 passwordVariable: 'GITHUB_PASSWORD',
288                                 usernameVariable: 'GITHUB_USER'
289                               )]) {
290                                 sh label: 'test-patch', script: '''
291                                     hostname -a ; pwd ; ls -la
292                                     printenv 2>&1 | sort
293                                     echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
294                                     "${YETUS_DRIVER}"
295                                 '''
296                             }
297                         }
298                     }
299                     post {
300                         always {
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"
308                                   else
309                                     echo "No archived files, skipping compressing."
310                                   fi
311                                 else
312                                   echo "No archiver directory, skipping compressing."
313                                 fi
314                             '''
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: [
319                               allowMissing: true,
320                               keepAll: true,
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'
326                             ]
327                         }
328                         // Jenkins pipeline jobs fill slaves on PRs without this :(
329                         cleanup() {
330                             script {
331                                 sh label: 'Cleanup workspace', script: '''
332                                     # See YETUS-764
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
336                                       sleep 10
337                                     fi
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
341                                     fi
342                                     # See HADOOP-13951
343                                     chmod -R u+rxw "${WORKSPACE}"
344                                 '''
345                                 dir ("${WORKDIR}") {
346                                     deleteDir()
347                                 }
348                             }
349                         }
350                     }
351                 }
352             }
353         }
354     }
356     post {
357         // Jenkins pipeline jobs fill slaves on PRs without this :(
358         cleanup() {
359             script {
360                 sh label: 'Cleanup workspace', script: '''
361                     # See HADOOP-13951
362                     chmod -R u+rxw "${WORKSPACE}"
363                     '''
364                 deleteDir()
365             }
366         }
367     }