Skip to content

Commit 75244b4

Browse files
gregturnmp911de
authored andcommitted
Externalize build properties.
By reading a properties file from an external location, it is possible to inject a consistent set of properties from Spring Data Build. This also supports repeatable builds. Closes #1214.
1 parent e371f0c commit 75244b4

File tree

3 files changed

+40
-5
lines changed

3 files changed

+40
-5
lines changed

Jenkinsfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
def p = [:]
2+
node {
3+
checkout scm
4+
p = readProperties interpolate: true, file: 'ci/pipeline.properties'
5+
}
6+
17
pipeline {
28
agent none
39

@@ -16,14 +22,17 @@ pipeline {
1622
parallel {
1723
stage('Publish JDK 17 + Cassandra 3.11') {
1824
when {
19-
changeset "ci/openjdk17-8-cassandra-3.11/**"
25+
anyOf {
26+
changeset "ci/openjdk17-8-cassandra-3.11/**"
27+
changeset "ci/pipeline.properties"
28+
}
2029
}
2130
agent { label 'data' }
2231
options { timeout(time: 30, unit: 'MINUTES') }
2332

2433
steps {
2534
script {
26-
def image = docker.build("springci/spring-data-openjdk17-8-cassandra-3.11", "ci/openjdk17-8-cassandra-3.11/")
35+
def image = docker.build("springci/spring-data-with-cassandra-3.11:${p['java.lts.tag']}", "--build-arg BASE=${p['docker.java.lts.image']} --build-arg CASSANDRA=${p['docker.cassandra.3.version']} ci/openjdk17-8-cassandra-3.11/")
2736
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
2837
image.push()
2938
}
@@ -81,7 +90,7 @@ pipeline {
8190
steps {
8291
script {
8392
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
84-
docker.image('openjdk:17-bullseye').inside('-v $HOME:/tmp/jenkins-home') {
93+
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
8594
sh 'mkdir -p /tmp/jenkins-home'
8695
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' +
8796
'-Dartifactory.server=https://repo.spring.io ' +

ci/openjdk17-8-cassandra-3.11/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
FROM openjdk:17-bullseye
1+
ARG BASE
2+
FROM ${BASE}
3+
# Any ARG statements before FROM are cleared.
4+
ARG CASSANDRA
25

36
RUN set -eux; \
4-
CASSANDRA_URL='https://archive.apache.org/dist/cassandra/3.11.11/apache-cassandra-3.11.11-bin.tar.gz'; \
7+
CASSANDRA_URL="https://archive.apache.org/dist/cassandra/${CASSANDRA}/apache-cassandra-${CASSANDRA}-bin.tar.gz"; \
58
sed -i -e 's/http/https/g' /etc/apt/sources.list ; \
69
curl -LfsSo /tmp/cassandra.tar.gz ${CASSANDRA_URL}; \
710
mkdir -p /opt/cassandra /opt/cassandra/data /opt/cassandra/logs; \

ci/pipeline.properties

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Java versions
2+
java.main.tag=17.0.2_8-jdk
3+
4+
# Docker container images - standard
5+
docker.java.main.image=eclipse-temurin:${java.main.tag}
6+
7+
# Supported versions of MongoDB
8+
docker.mongodb.4.4.version=4.4.4
9+
docker.mongodb.5.0.version=5.0.3
10+
11+
# Supported versions of Redis
12+
docker.redis.6.version=6.2.4
13+
14+
# Supported versions of Cassandra
15+
docker.cassandra.3.version=3.11.11
16+
17+
# Docker environment settings
18+
docker.java.inside.basic=-v $HOME:/tmp/jenkins-home
19+
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
20+
21+
# Credentials
22+
docker.registry=
23+
docker.credentials=hub.docker.com-springbuildmaster

0 commit comments

Comments
 (0)