HBASE-23723 Ensure MOB compaction works in optimized mode after snapshot clone (...
[hbase.git] / dev-support / Jenkinsfile_GitHub
blobfdd6c6081862c7f0bfe2f4823641513fb874aa09
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_HADOOP2_CHECK = 'yetus-jdk8-hadoop2-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 Hadoop2 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_HADOOP2_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                         HADOOP_PROFILE = '3.0'
263                         WORKDIR_REL = "${WORKDIR_REL_JDK11_HADOOP3_CHECK}"
264                         // identical for all parallel stages
265                         WORKDIR = "${WORKSPACE}/${WORKDIR_REL}"
266                         YETUSDIR = "${WORKDIR}/${YETUS_REL}"
267                         SOURCEDIR = "${WORKDIR}/${SRC_REL}"
268                         PATCHDIR = "${WORKDIR}/${PATCH_REL}"
269                         BUILD_URL_ARTIFACTS = "artifact/${WORKDIR_REL}/${PATCH_REL}"
270                         DOCKERFILE = "${WORKDIR}/${DOCKERFILE_REL}"
271                         YETUS_DRIVER = "${WORKDIR}/${YETUS_DRIVER_REL}"
272                     }
273                     steps {
274                         dir("${SOURCEDIR}") {
275                             checkout scm
276                         }
277                         dir("${YETUSDIR}") {
278                             checkout([
279                               $class           : 'GitSCM',
280                               branches         : [[name: "${YETUS_VERSION}"]],
281                               userRemoteConfigs: [[url: 'https://github.com/apache/yetus.git']]]
282                             )
283                         }
284                         dir("${WORKDIR}") {
285                             withCredentials([
286                               usernamePassword(
287                                 credentialsId: 'apache-hbase-at-github.com',
288                                 passwordVariable: 'GITHUB_PASSWORD',
289                                 usernameVariable: 'GITHUB_USER'
290                               )]) {
291                                 sh label: 'test-patch', script: '''
292                                     hostname -a ; pwd ; ls -la
293                                     printenv 2>&1 | sort
294                                     echo "[INFO] Launching Yetus via ${YETUS_DRIVER}"
295                                     "${YETUS_DRIVER}"
296                                 '''
297                             }
298                         }
299                     }
300                     post {
301                         always {
302                             junit testResults: "${WORKDIR_REL}/${SRC_REL}/**/target/**/TEST-*.xml", allowEmptyResults: true
303                             sh label: 'zip surefire reports', script: '''
304                                 if [ -d "${PATCHDIR}/archiver" ]; then
305                                   count=$(find "${PATCHDIR}/archiver" -type f | wc -l)
306                                   if [[ 0 -ne ${count} ]]; then
307                                     echo "zipping ${count} archived files"
308                                     zip -q -m -r "${PATCHDIR}/test_logs.zip" "${PATCHDIR}/archiver"
309                                   else
310                                     echo "No archived files, skipping compressing."
311                                   fi
312                                 else
313                                   echo "No archiver directory, skipping compressing."
314                                 fi
315                             '''
316                             // Has to be relative to WORKSPACE.
317                             archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit"
318                             archiveArtifacts artifacts: "${WORKDIR_REL}/${PATCH_REL}/**/*", excludes: "${WORKDIR_REL}/${PATCH_REL}/precommit/**/*"
319                             publishHTML target: [
320                               allowMissing: true,
321                               keepAll: true,
322                               alwaysLinkToLastBuild: true,
323                               // Has to be relative to WORKSPACE
324                               reportDir: "${WORKDIR_REL}/${PATCH_REL}",
325                               reportFiles: 'report.html',
326                               reportName: 'PR JDK11 Hadoop3 Check Report'
327                             ]
328                         }
329                         // Jenkins pipeline jobs fill slaves on PRs without this :(
330                         cleanup() {
331                             script {
332                                 sh label: 'Cleanup workspace', script: '''
333                                     # See YETUS-764
334                                     if [ -f "${PATCHDIR}/pidfile.txt" ]; then
335                                       echo "test-patch process appears to still be running: killing"
336                                       kill `cat "${PATCHDIR}/pidfile.txt"` || true
337                                       sleep 10
338                                     fi
339                                     if [ -f "${PATCHDIR}/cidfile.txt" ]; then
340                                       echo "test-patch container appears to still be running: killing"
341                                       docker kill `cat "${PATCHDIR}/cidfile.txt"` || true
342                                     fi
343                                     # See HADOOP-13951
344                                     chmod -R u+rxw "${WORKSPACE}"
345                                 '''
346                                 dir ("${WORKDIR}") {
347                                     deleteDir()
348                                 }
349                             }
350                         }
351                     }
352                 }
353             }
354         }
355     }
357     post {
358         // Jenkins pipeline jobs fill slaves on PRs without this :(
359         cleanup() {
360             script {
361                 sh label: 'Cleanup workspace', script: '''
362                     # See HADOOP-13951
363                     chmod -R u+rxw "${WORKSPACE}"
364                     '''
365                 deleteDir()
366             }
367         }
368     }