Skip to content

Commit

Permalink
Externalize build properties.
Browse files Browse the repository at this point in the history
See #2074.
  • Loading branch information
gregturn committed Jan 31, 2022
1 parent 4a0e7cc commit 14cc9ea
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
22 changes: 14 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
def p = [:]
node {
checkout scm
p = readProperties interpolate: true, file: 'ci/pipeline.properties'
}

pipeline {
agent none

Expand All @@ -12,7 +18,7 @@ pipeline {
}

stages {
stage("test: baseline (jdk8)") {
stage("test: baseline (main)") {
when {
anyOf {
branch 'main'
Expand All @@ -32,7 +38,7 @@ pipeline {
steps {
script {
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
docker.image('adoptopenjdk/openjdk8:latest').inside('-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home') {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
sh "docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW}"
sh 'PROFILE=none ci/verify.sh'
sh "ci/clean.sh"
Expand All @@ -50,7 +56,7 @@ pipeline {
}
}
parallel {
stage("test: baseline (jdk11)") {
stage("test: baseline (next)") {
agent {
label 'data'
}
Expand All @@ -64,7 +70,7 @@ pipeline {
steps {
script {
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
docker.image('adoptopenjdk/openjdk11:latest').inside('-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home') {
docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) {
sh "docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW}"
sh 'PROFILE=java11 ci/verify.sh'
sh "ci/clean.sh"
Expand All @@ -74,7 +80,7 @@ pipeline {
}
}

stage("test: baseline (jdk17)") {
stage("test: baseline (LTS)") {
agent {
label 'data'
}
Expand All @@ -88,7 +94,7 @@ pipeline {
steps {
script {
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
docker.image('openjdk:17-bullseye').inside('-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home') {
docker.image(p['docker.java.lts.image']).inside(p['docker.java.inside.docker']) {
sh "docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW}"
sh 'PROFILE=java11 ci/verify.sh'
sh "ci/clean.sh"
Expand Down Expand Up @@ -119,7 +125,7 @@ pipeline {
steps {
script {
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
docker.image('adoptopenjdk/openjdk8:latest').inside('-v $HOME:/tmp/jenkins-home') {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch-non-root ' +
'-Dartifactory.server=https://repo.spring.io ' +
"-Dartifactory.username=${ARTIFACTORY_USR} " +
Expand Down Expand Up @@ -149,7 +155,7 @@ pipeline {
steps {
script {
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
docker.image('adoptopenjdk/openjdk8:latest').inside('-v $HOME:/tmp/jenkins-home') {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,distribute -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch-non-root ' +
'-Dartifactory.server=https://repo.spring.io ' +
"-Dartifactory.username=${ARTIFACTORY_USR} " +
Expand Down
24 changes: 24 additions & 0 deletions ci/pipeline.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Java versions
java.main.tag=8u312-b07-jdk
java.next.tag=11.0.13_8-jdk
java.lts.tag=17.0.1_12-jdk

# Docker container images - standard
docker.java.main.image=eclipse-temurin:${java.main.tag}
docker.java.next.image=eclipse-temurin:${java.next.tag}
docker.java.lts.image=eclipse-temurin:${java.lts.tag}

# Supported versions of MongoDB
docker.mongodb.4.0.version=4.0.23
docker.mongodb.4.4.version=4.4.4
docker.mongodb.5.0.version=5.0.3

# Supported versions of Redis
docker.redis.6.version=6.2.4

# Supported versions of Cassandra
docker.cassandra.3.version=3.11.10

# Docker environment settings
docker.java.inside.basic=-v $HOME:/tmp/jenkins-home
docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home

0 comments on commit 14cc9ea

Please sign in to comment.