Skip to content

Commit 57ac69e

Browse files
committed
Reconfigure the Jenkins CI build pipeline.
* Configure the buld to use the VMW provided Harbor DockerHub Proxy. * Use pipeline.properties to parameterize the build. * Remove Docker logins (docker.withRegistry(..) directtives in Jenkinsfile & 'docker login' command in setup.sh).
1 parent 4ff9bed commit 57ac69e

File tree

3 files changed

+63
-57
lines changed

3 files changed

+63
-57
lines changed

Jenkinsfile

Lines changed: 47 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
def p = [:]
2+
3+
node {
4+
checkout scm
5+
p = readProperties interpolate: true, file: 'ci/pipeline.properties'
6+
}
7+
18
pipeline {
29

310
agent any
411

5-
/*
6-
environment {
7-
JAVA_HOME = "${tool 'jdk8'}"
8-
}
9-
*/
10-
1112
options {
1213
buildDiscarder(logRotator(numToKeepStr: '15'))
1314
disableConcurrentBuilds()
@@ -20,40 +21,35 @@ pipeline {
2021
stages {
2122

2223
stage('Build') {
23-
environment {
24-
DOCKER_HUB = credentials('hub.docker.com-springbuildmaster')
25-
}
2624
options {
2725
timeout(time: 15, unit: "MINUTES")
2826
}
2927
steps {
3028
script {
31-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
32-
docker.image('adoptopenjdk/openjdk8:latest').inside('-u root -v /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp') {
29+
docker.image(p['docker.container.image.java.main']).inside(p['docker.container.inside.env.full']) {
3330

34-
sh "echo 'Setup build environment...'"
35-
sh "ci/setup.sh"
31+
sh "echo 'Setup build environment...'"
32+
sh "ci/setup.sh"
3633

37-
// Cleanup any prior build system resources
38-
try {
39-
sh "echo 'Clean up GemFire/Geode files & build artifacts...'"
40-
sh "ci/cleanupGemFiles.sh"
41-
sh "ci/cleanupArtifacts.sh"
42-
}
43-
catch (ignore) { }
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) { }
4441

45-
// Run the SBDG project Gradle build using JDK 8 inside Docker
46-
try {
47-
sh "echo 'Building SBDG...'"
48-
sh "ci/check.sh"
49-
}
50-
catch (e) {
51-
currentBuild.result = "FAILED: build"
52-
throw e
53-
}
54-
finally {
55-
junit '**/build/test-results/*/*.xml'
56-
}
42+
// Run the SBDG project Gradle build using JDK 8 inside Docker
43+
try {
44+
sh "echo 'Building SBDG...'"
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'
5753
}
5854
}
5955
}
@@ -63,16 +59,14 @@ pipeline {
6359
stage ('Deploy Docs') {
6460
steps {
6561
script {
66-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
67-
docker.image('adoptopenjdk/openjdk8:latest').inside("--name ${env.HOSTNAME}Two -u root -v /tmp:/tmp") {
68-
withCredentials([file(credentialsId: 'docs.spring.io-jenkins_private_ssh_key', variable: 'DEPLOY_SSH_KEY')]) {
69-
try {
70-
sh "ci/deployDocs.sh"
71-
}
72-
catch (e) {
73-
currentBuild.result = "FAILED: deploy docs"
74-
throw e
75-
}
62+
docker.image('adoptopenjdk/openjdk8:latest').inside("--name ${env.HOSTNAME}Two -u root -v /tmp:/tmp") {
63+
withCredentials([file(credentialsId: 'docs.spring.io-jenkins_private_ssh_key', variable: 'DEPLOY_SSH_KEY')]) {
64+
try {
65+
sh "ci/deployDocs.sh"
66+
}
67+
catch (e) {
68+
currentBuild.result = "FAILED: deploy docs"
69+
throw e
7670
}
7771
}
7872
}
@@ -83,19 +77,17 @@ pipeline {
8377
stage ('Deploy Artifacts') {
8478
steps {
8579
script {
86-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
87-
docker.image('adoptopenjdk/openjdk8:latest').inside("--name ${env.HOSTNAME}One -u root -v /tmp:/tmp") {
88-
withCredentials([file(credentialsId: 'spring-signing-secring.gpg', variable: 'SIGNING_KEYRING_FILE')]) {
89-
withCredentials([string(credentialsId: 'spring-gpg-passphrase', variable: 'SIGNING_PASSWORD')]) {
90-
withCredentials([usernamePassword(credentialsId: 'oss-token', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USERNAME')]) {
91-
withCredentials([usernamePassword(credentialsId: '02bd1690-b54f-4c9f-819d-a77cb7a9822c', usernameVariable: 'ARTIFACTORY_USERNAME', passwordVariable: 'ARTIFACTORY_PASSWORD')]) {
92-
try {
93-
sh "ci/deployArtifacts.sh"
94-
}
95-
catch (e) {
96-
currentBuild.result = "FAILED: deploy artifacts"
97-
throw e
98-
}
80+
docker.image('adoptopenjdk/openjdk8:latest').inside("--name ${env.HOSTNAME}One -u root -v /tmp:/tmp") {
81+
withCredentials([file(credentialsId: 'spring-signing-secring.gpg', variable: 'SIGNING_KEYRING_FILE')]) {
82+
withCredentials([string(credentialsId: 'spring-gpg-passphrase', variable: 'SIGNING_PASSWORD')]) {
83+
withCredentials([usernamePassword(credentialsId: 'oss-token', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USERNAME')]) {
84+
withCredentials([usernamePassword(credentialsId: '02bd1690-b54f-4c9f-819d-a77cb7a9822c', usernameVariable: 'ARTIFACTORY_USERNAME', passwordVariable: 'ARTIFACTORY_PASSWORD')]) {
85+
try {
86+
sh "ci/deployArtifacts.sh"
87+
}
88+
catch (e) {
89+
currentBuild.result = "FAILED: deploy artifacts"
90+
throw e
9991
}
10092
}
10193
}

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 /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp -v $HOME:/tmp/jenkins-home
10+
11+
# Credentials
12+
docker.registry=
13+
docker.credentials=hub.docker.com-springbuildmaster
14+
artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c

ci/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ chown -R 1001:1001 .
99
mkdir -p /tmp/geode/boot/artifacts-gradle-cache
1010
mkdir -p /tmp/geode/boot/build-gradle-cache
1111
mkdir -p /tmp/geode/boot/docs-gradle-cache
12-
echo "Logging into Docker..."
13-
docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW}
12+
#echo "Logging into Docker..."
13+
#docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW}
1414
exit 0

0 commit comments

Comments
 (0)