| 1 |
/* |
| 2 |
* Licensed to the Apache Software Foundation (ASF) under one |
| 3 |
* or more contributor license agreements. See the NOTICE file |
| 4 |
* distributed with this work for additional information |
| 5 |
* regarding copyright ownership. The ASF licenses this file |
| 6 |
* to you under the Apache License, Version 2.0 (the |
| 7 |
* "License"); you may not use this file except in compliance |
| 8 |
* with the License. You may obtain a copy of the License at |
| 9 |
* |
| 10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 11 |
* |
| 12 |
* Unless required by applicable law or agreed to in writing, |
| 13 |
* software distributed under the License is distributed on an |
| 14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 |
* KIND, either express or implied. See the License for the |
| 16 |
* specific language governing permissions and limitations |
| 17 |
* under the License. |
| 18 |
*/ |
| 19 |
pipeline { |
| 20 |
agent none |
| 21 |
options { |
| 22 |
buildDiscarder(logRotator(numToKeepStr: '10')) |
| 23 |
timeout(time: 12, unit: 'HOURS') |
| 24 |
} |
| 25 |
triggers { |
| 26 |
cron('@weekly') |
| 27 |
pollSCM('@daily') |
| 28 |
} |
| 29 |
stages { |
| 30 |
stage ('Debug') { |
| 31 |
options { |
| 32 |
timeout(time: 1, unit: 'HOURS') |
| 33 |
retry(2) |
| 34 |
} |
| 35 |
agent { |
| 36 |
docker { |
| 37 |
label 'ubuntu && !H28 && !H36 && !H40' |
| 38 |
image 'apachedirectory/maven-build:jdk-8' |
| 39 |
args '-v $HOME/.m2:/home/hnelson/.m2' |
| 40 |
} |
| 41 |
} |
| 42 |
steps { |
| 43 |
sh 'env' |
| 44 |
} |
| 45 |
post { |
| 46 |
always { |
| 47 |
deleteDir() |
| 48 |
} |
| 49 |
} |
| 50 |
} |
| 51 |
stage ('Build and Test') { |
| 52 |
parallel { |
| 53 |
stage ('Linux Java 8') { |
| 54 |
options { |
| 55 |
timeout(time: 4, unit: 'HOURS') |
| 56 |
retry(2) |
| 57 |
} |
| 58 |
agent { |
| 59 |
docker { |
| 60 |
label 'ubuntu && !H28 && !H36 && !H40' |
| 61 |
image 'apachedirectory/maven-build:jdk-8' |
| 62 |
args '-v $HOME/.m2:/home/hnelson/.m2' |
| 63 |
} |
| 64 |
} |
| 65 |
steps { |
| 66 |
sh ''' |
| 67 |
mvn -V -U clean verify |
| 68 |
''' |
| 69 |
} |
| 70 |
post { |
| 71 |
always { |
| 72 |
junit '**/target/surefire-reports/*.xml' |
| 73 |
deleteDir() |
| 74 |
} |
| 75 |
} |
| 76 |
} |
| 77 |
stage ('Linux Java 11') { |
| 78 |
options { |
| 79 |
timeout(time: 4, unit: 'HOURS') |
| 80 |
retry(2) |
| 81 |
} |
| 82 |
agent { |
| 83 |
docker { |
| 84 |
label 'ubuntu && !H28 && !H36 && !H40' |
| 85 |
image 'apachedirectory/maven-build:jdk-11' |
| 86 |
args '-v $HOME/.m2:/home/hnelson/.m2' |
| 87 |
} |
| 88 |
} |
| 89 |
steps { |
| 90 |
sh 'mvn -V -U clean verify' |
| 91 |
} |
| 92 |
post { |
| 93 |
always { |
| 94 |
junit '**/target/surefire-reports/*.xml' |
| 95 |
deleteDir() |
| 96 |
} |
| 97 |
} |
| 98 |
} |
| 99 |
stage ('Linux Java 12') { |
| 100 |
options { |
| 101 |
timeout(time: 4, unit: 'HOURS') |
| 102 |
retry(2) |
| 103 |
} |
| 104 |
agent { |
| 105 |
docker { |
| 106 |
label 'ubuntu && !H28 && !H36 && !H40' |
| 107 |
image 'apachedirectory/maven-build:jdk-12' |
| 108 |
args '-v $HOME/.m2:/home/hnelson/.m2' |
| 109 |
} |
| 110 |
} |
| 111 |
steps { |
| 112 |
sh 'mvn -V -U clean verify' |
| 113 |
} |
| 114 |
post { |
| 115 |
always { |
| 116 |
junit '**/target/surefire-reports/*.xml' |
| 117 |
deleteDir() |
| 118 |
} |
| 119 |
} |
| 120 |
} |
| 121 |
stage ('Windows Java 8') { |
| 122 |
options { |
| 123 |
timeout(time: 4, unit: 'HOURS') |
| 124 |
retry(2) |
| 125 |
} |
| 126 |
agent { |
| 127 |
label 'Windows' |
| 128 |
} |
| 129 |
steps { |
| 130 |
// TODO: need to investigate test failure on Windows |
| 131 |
bat ''' |
| 132 |
set JAVA_HOME=F:\\jenkins\\tools\\java\\latest1.8 |
| 133 |
set MAVEN_OPTS="-Xmx512m" |
| 134 |
F:\\jenkins\\tools\\maven\\latest3\\bin\\mvn -V -U clean verify |
| 135 |
''' |
| 136 |
} |
| 137 |
post { |
| 138 |
always { |
| 139 |
junit '**/target/surefire-reports/*.xml' |
| 140 |
deleteDir() |
| 141 |
} |
| 142 |
} |
| 143 |
} |
| 144 |
} |
| 145 |
} |
| 146 |
stage ('Deploy') { |
| 147 |
options { |
| 148 |
timeout(time: 4, unit: 'HOURS') |
| 149 |
retry(2) |
| 150 |
} |
| 151 |
agent { |
| 152 |
label 'ubuntu && !H28 && !H36 && !H40' |
| 153 |
} |
| 154 |
// https://cwiki.apache.org/confluence/display/INFRA/JDK+Installation+Matrix |
| 155 |
// https://cwiki.apache.org/confluence/display/INFRA/Maven+Installation+Matrix |
| 156 |
steps { |
| 157 |
sh ''' |
| 158 |
export JAVA_HOME=/home/jenkins/tools/java/latest1.8 |
| 159 |
export MAVEN_OPTS="-Xmx512m" |
| 160 |
/home/jenkins/tools/maven/latest3/bin/mvn -V -U clean deploy -DskipTests |
| 161 |
''' |
| 162 |
} |
| 163 |
post { |
| 164 |
always { |
| 165 |
deleteDir() |
| 166 |
} |
| 167 |
} |
| 168 |
} |
| 169 |
stage ('Build Installers') { |
| 170 |
options { |
| 171 |
timeout(time: 2, unit: 'HOURS') |
| 172 |
retry(2) |
| 173 |
} |
| 174 |
agent { |
| 175 |
docker { |
| 176 |
label 'ubuntu && !H28 && !H36 && !H40' |
| 177 |
image 'apachedirectory/maven-build:jdk-8' |
| 178 |
args '-v $HOME/.m2:/home/hnelson/.m2' |
| 179 |
alwaysPull true |
| 180 |
} |
| 181 |
} |
| 182 |
steps { |
| 183 |
sh 'mvn -V -U clean verify -DskipTests -Pinstallers -Pdocker' |
| 184 |
stash name: 'deb', includes: 'installers/target/installers/*.deb,installers/target/docker/*deb*' |
| 185 |
stash name: 'rpm', includes: 'installers/target/installers/*.rpm,installers/target/docker/*rpm*' |
| 186 |
stash name: 'bin', includes: 'installers/target/installers/*.bin,installers/target/docker/*bin*' |
| 187 |
stash name: 'archive', includes: 'installers/target/installers/*.zip,installers/target/installers/*.tar.gz,installers/target/docker/*archive*' |
| 188 |
} |
| 189 |
post { |
| 190 |
always { |
| 191 |
archiveArtifacts 'installers/target/installers/*.zip,installers/target/installers/*.tar.gz,installers/target/installers/*.dmg,installers/target/installers/*.exe,installers/target/installers/*.bin,installers/target/installers/*.deb,installers/target/installers/*.rpm' |
| 192 |
deleteDir() |
| 193 |
} |
| 194 |
} |
| 195 |
} |
| 196 |
stage ('Test Installers') { |
| 197 |
parallel { |
| 198 |
stage ('deb') { |
| 199 |
options { |
| 200 |
timeout(time: 2, unit: 'HOURS') |
| 201 |
retry(2) |
| 202 |
} |
| 203 |
agent { |
| 204 |
label 'ubuntu && !H28 && !H36 && !H40' |
| 205 |
} |
| 206 |
steps { |
| 207 |
unstash 'deb' |
| 208 |
sh 'bash installers/target/docker/run-deb-tests.sh' |
| 209 |
} |
| 210 |
post { |
| 211 |
always { |
| 212 |
deleteDir() |
| 213 |
} |
| 214 |
} |
| 215 |
} |
| 216 |
stage ('rpm') { |
| 217 |
options { |
| 218 |
timeout(time: 2, unit: 'HOURS') |
| 219 |
retry(2) |
| 220 |
} |
| 221 |
agent { |
| 222 |
label 'ubuntu && !H28 && !H36 && !H40' |
| 223 |
} |
| 224 |
steps { |
| 225 |
unstash 'rpm' |
| 226 |
sh 'bash installers/target/docker/run-rpm-tests.sh' |
| 227 |
} |
| 228 |
post { |
| 229 |
always { |
| 230 |
deleteDir() |
| 231 |
} |
| 232 |
} |
| 233 |
} |
| 234 |
stage ('bin') { |
| 235 |
options { |
| 236 |
timeout(time: 2, unit: 'HOURS') |
| 237 |
retry(2) |
| 238 |
} |
| 239 |
agent { |
| 240 |
label 'ubuntu && !H28 && !H36 && !H40' |
| 241 |
} |
| 242 |
steps { |
| 243 |
unstash 'bin' |
| 244 |
sh 'bash installers/target/docker/run-bin-tests.sh' |
| 245 |
} |
| 246 |
post { |
| 247 |
always { |
| 248 |
deleteDir() |
| 249 |
} |
| 250 |
} |
| 251 |
} |
| 252 |
stage ('archive') { |
| 253 |
options { |
| 254 |
timeout(time: 2, unit: 'HOURS') |
| 255 |
retry(2) |
| 256 |
} |
| 257 |
agent { |
| 258 |
label 'ubuntu && !H28 && !H36 && !H40' |
| 259 |
} |
| 260 |
steps { |
| 261 |
unstash 'archive' |
| 262 |
sh 'bash installers/target/docker/run-archive-tests.sh' |
| 263 |
} |
| 264 |
post { |
| 265 |
always { |
| 266 |
deleteDir() |
| 267 |
} |
| 268 |
} |
| 269 |
} |
| 270 |
} |
| 271 |
} |
| 272 |
} |
| 273 |
post { |
| 274 |
failure { |
| 275 |
mail to: '[email protected]', |
| 276 |
subject: "Jenkins pipeline failed: ${currentBuild.fullDisplayName}", |
| 277 |
body: "Jenkins build URL: ${env.BUILD_URL}" |
| 278 |
} |
| 279 |
fixed { |
| 280 |
mail to: '[email protected]', |
| 281 |
subject: "Jenkins pipeline fixed: ${currentBuild.fullDisplayName}", |
| 282 |
body: "Jenkins build URL: ${env.BUILD_URL}" |
| 283 |
} |
| 284 |
} |
| 285 |
} |
| 286 |
|