|
1 | | -properties([ |
2 | | - buildDiscarder(logRotator(numToKeepStr: '10')), |
3 | | - pipelineTriggers([ |
| 1 | +def p = [:] |
| 2 | + |
| 3 | +node { |
| 4 | + checkout scm |
| 5 | + p = readProperties interpolate: true, file: 'ci/pipeline.properties' |
| 6 | +} |
| 7 | + |
| 8 | +pipeline { |
| 9 | + |
| 10 | + agent any |
| 11 | + |
| 12 | + options { |
| 13 | + buildDiscarder(logRotator(numToKeepStr: '10')) |
| 14 | + disableConcurrentBuilds() |
| 15 | + } |
| 16 | + |
| 17 | + triggers { |
4 | 18 | cron('@daily') |
5 | | - ]), |
6 | | -]) |
7 | | - |
8 | | -def SUCCESS = hudson.model.Result.SUCCESS.toString() |
9 | | -currentBuild.result = SUCCESS |
10 | | - |
11 | | -try { |
12 | | - parallel check: { |
13 | | - stage('Check') { |
14 | | - timeout(time: 10, unit: 'MINUTES') { |
15 | | - node('linux') { |
16 | | - checkout scm |
17 | | - try { |
18 | | - withEnv(["JAVA_HOME=${tool 'jdk8'}"]) { |
19 | | - sh './gradlew clean check --no-daemon --refresh-dependencies --stacktrace' |
| 19 | + } |
| 20 | + |
| 21 | + stages { |
| 22 | + |
| 23 | + stage('Build') { |
| 24 | + options { |
| 25 | + timeout(time: 15, unit: "MINUTES") |
| 26 | + } |
| 27 | + steps { |
| 28 | + script { |
| 29 | + docker.image(p['docker.container.image.java.main']).inside(p['docker.container.inside.env.full']) { |
| 30 | + |
| 31 | + sh "echo 'Setup build environment...'" |
| 32 | + sh "ci/setup.sh" |
| 33 | + |
| 34 | + // Cleanup any prior build system resources |
| 35 | + try { |
| 36 | + sh "echo 'Clean up GemFire/Geode files & build artifacts...'" |
| 37 | + sh "ci/cleanupGemFiles.sh" |
| 38 | + sh "ci/cleanupArtifacts.sh" |
| 39 | + } |
| 40 | + catch (ignore) { } |
| 41 | + |
| 42 | + // Run the SBDG project Gradle build using JDK 8 inside Docker |
| 43 | + try { |
| 44 | + sh "echo 'Building SSDG...'" |
| 45 | + sh "ci/check.sh" |
| 46 | + } |
| 47 | + catch (e) { |
| 48 | + currentBuild.result = "FAILED: build" |
| 49 | + throw e |
| 50 | + } |
| 51 | + finally { |
| 52 | + junit '**/build/test-results/*/*.xml' |
20 | 53 | } |
21 | 54 | } |
22 | | - catch (e) { |
23 | | - currentBuild.result = 'FAILED: check' |
24 | | - throw e |
25 | | - } |
26 | | - finally { |
27 | | - junit '**/build/test-results/*/*.xml' |
| 55 | + } |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | +/* |
| 60 | + stage ('Deploy Docs') { |
| 61 | + options { |
| 62 | + timeout(time: 15, unit: "MINUTES") |
| 63 | + } |
| 64 | + steps { |
| 65 | + script { |
| 66 | + docker.image('openjdk:17-bullseye').inside("--name ${env.HOSTNAME}Two -u root -v /tmp:/tmp") { |
| 67 | + withCredentials([file(credentialsId: 'docs.spring.io-jenkins_private_ssh_key', variable: 'DEPLOY_SSH_KEY')]) { |
| 68 | + try { |
| 69 | + sh "ci/deployDocs.sh" |
| 70 | + } |
| 71 | + catch (e) { |
| 72 | + currentBuild.result = "FAILED: deploy docs" |
| 73 | + throw e |
| 74 | + } |
| 75 | + } |
28 | 76 | } |
29 | 77 | } |
30 | 78 | } |
31 | 79 | } |
32 | | - } |
| 80 | + */ |
33 | 81 |
|
34 | | - if (currentBuild.result == 'SUCCESS') { |
35 | | - parallel artifacts: { |
36 | | - stage('Deploy Artifacts') { |
37 | | - node('linux') { |
38 | | - checkout scm |
39 | | - try { |
| 82 | + stage ('Deploy Artifacts') { |
| 83 | + options { |
| 84 | + timeout(time: 15, unit: "MINUTES") |
| 85 | + } |
| 86 | + steps { |
| 87 | + script { |
| 88 | + docker.image('openjdk:17-bullseye').inside("--name ${env.HOSTNAME}One -u root -v /tmp:/tmp") { |
40 | 89 | withCredentials([file(credentialsId: 'spring-signing-secring.gpg', variable: 'SIGNING_KEYRING_FILE')]) { |
41 | 90 | withCredentials([string(credentialsId: 'spring-gpg-passphrase', variable: 'SIGNING_PASSWORD')]) { |
42 | 91 | withCredentials([usernamePassword(credentialsId: 'oss-token', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USERNAME')]) { |
43 | 92 | withCredentials([usernamePassword(credentialsId: '02bd1690-b54f-4c9f-819d-a77cb7a9822c', usernameVariable: 'ARTIFACTORY_USERNAME', passwordVariable: 'ARTIFACTORY_PASSWORD')]) { |
44 | | - withEnv(["JAVA_HOME=${tool 'jdk8'}"]) { |
45 | | - sh './gradlew deployArtifacts finalizeDeployArtifacts --no-daemon --refresh-dependencies --stacktrace -Psigning.secretKeyRingFile=$SIGNING_KEYRING_FILE -Psigning.keyId=$SPRING_SIGNING_KEYID -Psigning.password=$SIGNING_PASSWORD -PossrhUsername=$OSSRH_USERNAME -PossrhPassword=$OSSRH_PASSWORD -PartifactoryUsername=$ARTIFACTORY_USERNAME -PartifactoryPassword=$ARTIFACTORY_PASSWORD' |
| 93 | + try { |
| 94 | + sh "ci/deployArtifacts.sh" |
| 95 | + } |
| 96 | + catch (e) { |
| 97 | + currentBuild.result = "FAILED: deploy artifacts" |
| 98 | + throw e |
46 | 99 | } |
47 | 100 | } |
48 | 101 | } |
49 | 102 | } |
50 | 103 | } |
51 | 104 | } |
52 | | - catch (e) { |
53 | | - currentBuild.result = 'FAILED: artifacts' |
54 | | - throw e |
55 | | - } |
56 | 105 | } |
57 | 106 | } |
58 | 107 | } |
59 | 108 | } |
60 | | -} |
61 | | -finally { |
62 | 109 |
|
63 | | - def buildStatus = currentBuild.result |
64 | | - def buildNotSuccess = !SUCCESS.equals(buildStatus) |
65 | | - def lastBuildNotSuccess = !SUCCESS.equals(currentBuild.previousBuild?.result) |
| 110 | + post { |
| 111 | + changed { |
| 112 | + script { |
66 | 113 |
|
67 | | - if (buildNotSuccess || lastBuildNotSuccess) { |
68 | | - stage('Notify') { |
69 | | - node { |
| 114 | + def BUILD_SUCCESS = hudson.model.Result.SUCCESS.toString() |
| 115 | + def buildStatus = currentBuild.result |
| 116 | + def buildNotSuccess = !BUILD_SUCCESS.equals(buildStatus) |
| 117 | + def previousBuildStatus = currentBuild.previousBuild?.result |
| 118 | + def previousBuildNotSuccess = !BUILD_SUCCESS.equals(previousBuildStatus) |
70 | 119 |
|
71 | | - final def RECIPIENTS = [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']] |
| 120 | + if (buildNotSuccess || previousBuildNotSuccess) { |
72 | 121 |
|
73 | | - def subject = "${buildStatus}: Build ${env.JOB_NAME} ${env.BUILD_NUMBER} status is now ${buildStatus}" |
74 | | - def details = "The build status changed to ${buildStatus}. For details see ${env.BUILD_URL}" |
| 122 | + def RECIPIENTS = [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']] |
| 123 | + def subject = "${buildStatus}: Build ${env.JOB_NAME} ${env.BUILD_NUMBER} status is now ${buildStatus}" |
| 124 | + def details = "The build status changed to ${buildStatus}. For details see ${env.BUILD_URL}" |
75 | 125 |
|
76 | | - emailext( |
77 | | - subject: subject, |
78 | | - body: details, |
79 | | - recipientProviders: RECIPIENTS, |
80 | | - to: "$GEODE_TEAM_EMAILS" |
81 | | - ) |
| 126 | + emailext(subject: subject, body: details, recipientProviders: RECIPIENTS, to: "$GEODE_TEAM_EMAILS") |
| 127 | + |
| 128 | +/* |
| 129 | + slackSend(color: (currentBuild.currentResult == 'SUCCESS') ? 'good' : 'danger', |
| 130 | + channel: '#spring-data-dev', |
| 131 | + message: "${currentBuild.fullDisplayName} - `${currentBuild.currentResult}`\n${env.BUILD_URL}") |
| 132 | + */ |
| 133 | + } |
82 | 134 | } |
83 | 135 | } |
84 | 136 | } |
|
0 commit comments