|
| 1 | +pipeline { |
| 2 | + agent none |
| 3 | + |
| 4 | + triggers { |
| 5 | + pollSCM 'H/10 * * * *' |
| 6 | + } |
| 7 | + |
| 8 | + options { |
| 9 | + disableConcurrentBuilds() |
| 10 | + } |
| 11 | + |
| 12 | + stages { |
| 13 | + stage('Publish OpenJDK 8 + jq docker image') { |
| 14 | + when { |
| 15 | + changeset "ci/Dockerfile" |
| 16 | + } |
| 17 | + agent any |
| 18 | + |
| 19 | + steps { |
| 20 | + script { |
| 21 | + def image = docker.build("springci/spring-ws-openjdk8-with-jq", "ci/") |
| 22 | + docker.withRegistry('', 'hub.docker.com-springbuildmaster') { |
| 23 | + image.push() |
| 24 | + } |
| 25 | + } |
| 26 | + } |
| 27 | + } |
| 28 | + stage("Test: baseline (jdk8)") { |
| 29 | + agent { |
| 30 | + docker { |
| 31 | + image 'adoptopenjdk/openjdk8:latest' |
| 32 | + args '-v $HOME/.m2:/root/.m2' |
| 33 | + } |
| 34 | + } |
| 35 | + steps { |
| 36 | + sh "PROFILE=distribute,convergence ci/test.sh" |
| 37 | + } |
| 38 | + } |
| 39 | + stage("Test other configurations") { |
| 40 | + parallel { |
| 41 | + stage("Test: springnext (jdk8)") { |
| 42 | + agent { |
| 43 | + docker { |
| 44 | + image 'adoptopenjdk/openjdk8:latest' |
| 45 | + args '-v $HOME/.m2:/root/.m2' |
| 46 | + } |
| 47 | + } |
| 48 | + steps { |
| 49 | + sh "PROFILE=springnext,convergence ci/test.sh" |
| 50 | + } |
| 51 | + } |
| 52 | + stage("Test: springnext-buildsnapshot (jdk8)") { |
| 53 | + agent { |
| 54 | + docker { |
| 55 | + image 'adoptopenjdk/openjdk8:latest' |
| 56 | + args '-v $HOME/.m2:/root/.m2' |
| 57 | + } |
| 58 | + } |
| 59 | + steps { |
| 60 | + sh "PROFILE=springnext-buildsnapshot,convergence ci/test.sh" |
| 61 | + } |
| 62 | + } |
| 63 | + stage("Test: spring-buildsnapshot (jdk8)") { |
| 64 | + agent { |
| 65 | + docker { |
| 66 | + image 'adoptopenjdk/openjdk8:latest' |
| 67 | + args '-v $HOME/.m2:/root/.m2' |
| 68 | + } |
| 69 | + } |
| 70 | + steps { |
| 71 | + sh "PROFILE=spring-buildsnapshot,convergence ci/test.sh" |
| 72 | + } |
| 73 | + } |
| 74 | + stage("Test: baseline (jdk11)") { |
| 75 | + agent { |
| 76 | + docker { |
| 77 | + image 'adoptopenjdk/openjdk11:latest' |
| 78 | + args '-v $HOME/.m2:/root/.m2' |
| 79 | + } |
| 80 | + } |
| 81 | + steps { |
| 82 | + sh "PROFILE=distribute,java11,convergence ci/test.sh" |
| 83 | + } |
| 84 | + } |
| 85 | + stage("Test: springnext (jdk11)") { |
| 86 | + agent { |
| 87 | + docker { |
| 88 | + image 'adoptopenjdk/openjdk11:latest' |
| 89 | + args '-v $HOME/.m2:/root/.m2' |
| 90 | + } |
| 91 | + } |
| 92 | + steps { |
| 93 | + sh "PROFILE=springnext,java11,convergence ci/test.sh" |
| 94 | + } |
| 95 | + } |
| 96 | + stage("Test: springnext-buildsnapshot (jdk11)") { |
| 97 | + agent { |
| 98 | + docker { |
| 99 | + image 'adoptopenjdk/openjdk11:latest' |
| 100 | + args '-v $HOME/.m2:/root/.m2' |
| 101 | + } |
| 102 | + } |
| 103 | + steps { |
| 104 | + sh "PROFILE=springnext-buildsnapshot,java11,convergence ci/test.sh" |
| 105 | + } |
| 106 | + } |
| 107 | + stage("Test: spring-buildsnapshot (jdk11)") { |
| 108 | + agent { |
| 109 | + docker { |
| 110 | + image 'adoptopenjdk/openjdk11:latest' |
| 111 | + args '-v $HOME/.m2:/root/.m2' |
| 112 | + } |
| 113 | + } |
| 114 | + steps { |
| 115 | + sh "PROFILE=spring-buildsnapshot,java11,convergence ci/test.sh" |
| 116 | + } |
| 117 | + } |
| 118 | + stage("Test: baseline (jdk12)") { |
| 119 | + agent { |
| 120 | + docker { |
| 121 | + image 'adoptopenjdk/openjdk12:latest' |
| 122 | + args '-v $HOME/.m2:/root/.m2' |
| 123 | + } |
| 124 | + } |
| 125 | + steps { |
| 126 | + sh "PROFILE=distribute,java11,convergence ci/test.sh" |
| 127 | + } |
| 128 | + } |
| 129 | + stage("Test: springnext (jdk12)") { |
| 130 | + agent { |
| 131 | + docker { |
| 132 | + image 'adoptopenjdk/openjdk12:latest' |
| 133 | + args '-v $HOME/.m2:/root/.m2' |
| 134 | + } |
| 135 | + } |
| 136 | + steps { |
| 137 | + sh "PROFILE=springnext,java11,convergence ci/test.sh" |
| 138 | + } |
| 139 | + } |
| 140 | + stage("Test: springnext-buildsnapshot (jdk12)") { |
| 141 | + agent { |
| 142 | + docker { |
| 143 | + image 'adoptopenjdk/openjdk12:latest' |
| 144 | + args '-v $HOME/.m2:/root/.m2' |
| 145 | + } |
| 146 | + } |
| 147 | + steps { |
| 148 | + sh "PROFILE=springnext-buildsnapshot,java11,convergence ci/test.sh" |
| 149 | + } |
| 150 | + } |
| 151 | + stage("Test: spring-buildsnapshot (jdk12)") { |
| 152 | + agent { |
| 153 | + docker { |
| 154 | + image 'adoptopenjdk/openjdk12:latest' |
| 155 | + args '-v $HOME/.m2:/root/.m2' |
| 156 | + } |
| 157 | + } |
| 158 | + steps { |
| 159 | + sh "PROFILE=spring-buildsnapshot,java11,convergence ci/test.sh" |
| 160 | + } |
| 161 | + } |
| 162 | + } |
| 163 | + } |
| 164 | + stage('Deploy to Artifactory') { |
| 165 | + agent { |
| 166 | + docker { |
| 167 | + image 'adoptopenjdk/openjdk8:latest' |
| 168 | + args '-v $HOME/.m2:/root/.m2' |
| 169 | + } |
| 170 | + } |
| 171 | + |
| 172 | + environment { |
| 173 | + ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') |
| 174 | + } |
| 175 | + |
| 176 | + steps { |
| 177 | + script { |
| 178 | + // Warm up this plugin quietly before using it. |
| 179 | + sh "./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version" |
| 180 | + |
| 181 | + PROJECT_VERSION = sh( |
| 182 | + script: "./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO", |
| 183 | + returnStdout: true |
| 184 | + ).trim() |
| 185 | + |
| 186 | + RELEASE_TYPE = 'milestone' // .RC? or .M? |
| 187 | + |
| 188 | + if (PROJECT_VERSION.endsWith('BUILD-SNAPSHOT')) { |
| 189 | + RELEASE_TYPE = 'snapshot' |
| 190 | + } else if (PROJECT_VERSION.endsWith('RELEASE')) { |
| 191 | + RELEASE_TYPE = 'release' |
| 192 | + } |
| 193 | + |
| 194 | + OUTPUT = sh( |
| 195 | + script: "PROFILE=distribute,docs,${RELEASE_TYPE} ci/build.sh", |
| 196 | + returnStdout: true |
| 197 | + ).trim() |
| 198 | + |
| 199 | + echo "$OUTPUT" |
| 200 | + |
| 201 | + build_info_path = OUTPUT.split('\n') |
| 202 | + .find { it.contains('Artifactory Build Info Recorder') } |
| 203 | + .split('Saving Build Info to ')[1] |
| 204 | + .trim()[1..-2] |
| 205 | + |
| 206 | + dir(build_info_path + '/..') { |
| 207 | + stash name: 'build_info', includes: "*.json" |
| 208 | + } |
| 209 | + } |
| 210 | + } |
| 211 | + } |
| 212 | + stage('Promote to Bintray') { |
| 213 | + when { |
| 214 | + branch 'release' |
| 215 | + } |
| 216 | + agent { |
| 217 | + docker { |
| 218 | + image 'springci/spring-ws-openjdk8-with-jq:latest' |
| 219 | + args '-v $HOME/.m2:/root/.m2' |
| 220 | + } |
| 221 | + } |
| 222 | + |
| 223 | + environment { |
| 224 | + ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') |
| 225 | + } |
| 226 | + |
| 227 | + steps { |
| 228 | + script { |
| 229 | + // Warm up this plugin quietly before using it. |
| 230 | + sh "./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version" |
| 231 | + |
| 232 | + PROJECT_VERSION = sh( |
| 233 | + script: "./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO", |
| 234 | + returnStdout: true |
| 235 | + ).trim() |
| 236 | + |
| 237 | + if (PROJECT_VERSION.endsWith('RELEASE')) { |
| 238 | + unstash name: 'build_info' |
| 239 | + sh "ci/promote-to-bintray.sh" |
| 240 | + } else { |
| 241 | + echo "${PROJECT_VERSION} is not a candidate for promotion to Bintray." |
| 242 | + } |
| 243 | + } |
| 244 | + } |
| 245 | + } |
| 246 | + stage('Sync to Maven Central') { |
| 247 | + when { |
| 248 | + branch 'release' |
| 249 | + } |
| 250 | + agent { |
| 251 | + docker { |
| 252 | + image 'springci/spring-ws-openjdk8-with-jq:latest' |
| 253 | + args '-v $HOME/.m2:/root/.m2' |
| 254 | + } |
| 255 | + } |
| 256 | + |
| 257 | + environment { |
| 258 | + BINTRAY = credentials('Bintray-spring-operator') |
| 259 | + SONATYPE = credentials('oss-token') |
| 260 | + } |
| 261 | + |
| 262 | + steps { |
| 263 | + script { |
| 264 | + // Warm up this plugin quietly before using it. |
| 265 | + sh "./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version" |
| 266 | + |
| 267 | + PROJECT_VERSION = sh( |
| 268 | + script: "./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO", |
| 269 | + returnStdout: true |
| 270 | + ).trim() |
| 271 | + |
| 272 | + if (PROJECT_VERSION.endsWith('RELEASE')) { |
| 273 | + unstash name: 'build_info' |
| 274 | + sh "ci/sync-to-maven-central.sh" |
| 275 | + } else { |
| 276 | + echo "${PROJECT_VERSION} is not a candidate for syncing to Maven Central." |
| 277 | + } |
| 278 | + } |
| 279 | + } |
| 280 | + } |
| 281 | + } |
| 282 | + |
| 283 | + post { |
| 284 | + changed { |
| 285 | + script { |
| 286 | + slackSend( |
| 287 | + color: (currentBuild.currentResult == 'SUCCESS') ? 'good' : 'danger', |
| 288 | + channel: '#spring-ws', |
| 289 | + message: "${currentBuild.fullDisplayName} - `${currentBuild.currentResult}`\n${env.BUILD_URL}") |
| 290 | + emailext( |
| 291 | + subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}", |
| 292 | + mimeType: 'text/html', |
| 293 | + recipientProviders: [[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']], |
| 294 | + body: "<a href=\"${env.BUILD_URL}\">${currentBuild.fullDisplayName} is reported as ${currentBuild.currentResult}</a>") |
| 295 | + } |
| 296 | + } |
| 297 | + } |
| 298 | +} |
0 commit comments