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