Skip to content

Commit 144894a

Browse files
committed
Reconfigure the Jenkins CI build to use pipelines and build inside Docker containers.
1 parent 71cf4bb commit 144894a

File tree

2 files changed

+120
-54
lines changed

2 files changed

+120
-54
lines changed

Jenkinsfile

Lines changed: 106 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,136 @@
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 {
418
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'
2053
}
2154
}
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+
}
2876
}
2977
}
3078
}
3179
}
32-
}
80+
*/
3381

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") {
4089
withCredentials([file(credentialsId: 'spring-signing-secring.gpg', variable: 'SIGNING_KEYRING_FILE')]) {
4190
withCredentials([string(credentialsId: 'spring-gpg-passphrase', variable: 'SIGNING_PASSWORD')]) {
4291
withCredentials([usernamePassword(credentialsId: 'oss-token', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USERNAME')]) {
4392
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
4699
}
47100
}
48101
}
49102
}
50103
}
51104
}
52-
catch (e) {
53-
currentBuild.result = 'FAILED: artifacts'
54-
throw e
55-
}
56105
}
57106
}
58107
}
59108
}
60-
}
61-
finally {
62109

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 {
66113

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)
70119

71-
final def RECIPIENTS = [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']]
120+
if (buildNotSuccess || previousBuildNotSuccess) {
72121

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}"
75125

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+
}
82134
}
83135
}
84136
}

ci/pipeline.properties

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Java (JDK) versions
2+
java.main.tag=8u322-b06-jdk
3+
4+
# Docker Container Images
5+
docker.container.image.java.main=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclipse-temurin:${java.main.tag}
6+
7+
# Docker Environment Settings
8+
docker.container.inside.env.basic=-u root -v $HOME:/tmp/jenkins-home -v /tmp:/tmp
9+
docker.container.inside.env.full=-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v /tmp:/tmp -v $HOME:/tmp/jenkins-home
10+
11+
# Credentials
12+
artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c
13+
docker.credentials=hub.docker.com-springbuildmaster
14+
docker.registry=

0 commit comments

Comments
 (0)