Skip to content

Commit 9eaaf1c

Browse files
committed
Add Jenkins config
Closes gh-719
1 parent 884dbd3 commit 9eaaf1c

File tree

6 files changed

+318
-2
lines changed

6 files changed

+318
-2
lines changed

Jenkinsfile

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
def p = [:]
2+
node {
3+
checkout scm
4+
p = readProperties interpolate: true, file: 'ci/pipeline.properties'
5+
}
6+
7+
pipeline {
8+
agent none
9+
10+
triggers {
11+
pollSCM 'H/10 * * * *'
12+
}
13+
14+
options {
15+
disableConcurrentBuilds()
16+
buildDiscarder(logRotator(numToKeepStr: '14'))
17+
}
18+
19+
stages {
20+
stage("Docker images") {
21+
parallel {
22+
stage('Publish JDK 17 + Vault Docker image') {
23+
when {
24+
anyOf {
25+
changeset "ci/openjdk17-vault/Dockerfile"
26+
changeset "src/test/bash/install_vault.sh"
27+
changeset "ci/pipeline.properties"
28+
}
29+
}
30+
agent { label 'data' }
31+
options { timeout(time: 20, unit: 'MINUTES') }
32+
33+
steps {
34+
script {
35+
def image = docker.build("springci/spring-vault-openjdk17-vault:${p['java.main.tag']}-${p['docker.vault.version']}", "--build-arg BASE=${p['docker.java.main.image']} --build-arg VAULT=${p['docker.vault.version']} -f ci/openjdk17-vault/Dockerfile .")
36+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
37+
image.push()
38+
}
39+
}
40+
}
41+
}
42+
}
43+
}
44+
45+
stage("test: baseline (Java 17)") {
46+
when {
47+
beforeAgent(true)
48+
anyOf {
49+
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP")
50+
not { triggeredBy 'UpstreamCause' }
51+
}
52+
}
53+
agent {
54+
label 'data'
55+
}
56+
options { timeout(time: 30, unit: 'MINUTES') }
57+
environment {
58+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
59+
}
60+
steps {
61+
script {
62+
docker.image("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-vault-openjdk17-vault:${p['java.main.tag']}-${p['docker.vault.version']}").inside(p['docker.java.inside.basic']) {
63+
sh 'src/test/bash/create_certificates.sh'
64+
sh '/opt/vault/vault server -config=$(pwd)/src/test/bash/vault.conf &'
65+
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean dependency:list verify -Dsort -U -B'
66+
}
67+
}
68+
}
69+
}
70+
71+
stage('Release to artifactory') {
72+
when {
73+
beforeAgent(true)
74+
anyOf {
75+
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP")
76+
not { triggeredBy 'UpstreamCause' }
77+
}
78+
}
79+
agent {
80+
label 'data'
81+
}
82+
options { timeout(time: 20, unit: 'MINUTES') }
83+
84+
environment {
85+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
86+
}
87+
88+
steps {
89+
script {
90+
docker.image("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-vault-openjdk17-vault:${p['java.main.tag']}-${p['docker.vault.version']}").inside(p['docker.java.inside.basic']) {
91+
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' +
92+
'-Dartifactory.server=https://repo.spring.io ' +
93+
"-Dartifactory.username=${ARTIFACTORY_USR} " +
94+
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
95+
"-Dartifactory.staging-repository=libs-snapshot-local " +
96+
"-Dartifactory.build-name=spring-vault " +
97+
"-Dartifactory.build-number=${BUILD_NUMBER} " +
98+
'-Dmaven.test.skip=true clean deploy -U -B'
99+
}
100+
}
101+
}
102+
}
103+
}
104+
105+
post {
106+
changed {
107+
script {
108+
emailext(
109+
subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}",
110+
mimeType: 'text/html',
111+
recipientProviders: [[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']],
112+
body: "<a href=\"${env.BUILD_URL}\">${currentBuild.fullDisplayName} is reported as ${currentBuild.currentResult}</a>")
113+
}
114+
}
115+
}
116+
}

ci/openjdk17-vault/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ARG BASE
2+
FROM ${BASE}
3+
# Any ARG statements before FROM are cleared.
4+
5+
ENV TZ=Etc/UTC
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
8+
# Copy Vault's install file into the container
9+
10+
COPY ./src/test/bash/install_vault.sh /opt
11+
12+
ARG VAULT
13+
14+
RUN set -eux && \
15+
sed -i -e 's/archive.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
16+
sed -i -e 's/security.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
17+
sed -i -e 's/http/https/g' /etc/apt/sources.list && \
18+
apt-get update && apt-get install -y apt-transport-https apt-utils gnupg2 wget unzip && \
19+
echo ${TZ} > /etc/timezone && \
20+
rm -rf /var/lib/apt/lists/*
21+
22+
RUN set -eux && \
23+
cd /opt && \
24+
/opt/install_vault.sh -v ${VAULT}

ci/pipeline.properties

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Java versions
2+
java.main.tag=17.0.3_7-jdk
3+
4+
# Docker container images - standard
5+
docker.java.main.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclipse-temurin:${java.main.tag}
6+
7+
# Supported versions of MongoDB
8+
docker.vault.version=1.11.1
9+
10+
# Docker environment settings
11+
docker.java.inside.basic=-v $HOME:/tmp/jenkins-home
12+
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
13+
14+
# Credentials
15+
docker.registry=
16+
docker.credentials=hub.docker.com-springbuildmaster
17+
artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c

pom.xml

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@
599599

600600
<distributionManagement>
601601
<repository>
602-
<id>repo.spring.io</id>
602+
<id>spring-libs-milestone</id>
603603
<name>Spring Milestone Repository</name>
604604
<url>https://repo.spring.io/libs-milestone-local</url>
605605
</repository>
@@ -784,6 +784,71 @@
784784
</plugins>
785785
</build>
786786
</profile>
787+
788+
<profile>
789+
790+
<id>artifactory</id>
791+
792+
<distributionManagement>
793+
<repository>
794+
<id>spring-libs-snapshot</id>
795+
<name>Spring Snapshot Repository</name>
796+
<url>https://repo.spring.io/libs-snapshot-local</url>
797+
</repository>
798+
</distributionManagement>
799+
800+
<build>
801+
802+
<pluginManagement>
803+
<plugins>
804+
805+
<!-- Deploy to Artifactory -->
806+
807+
<plugin>
808+
<groupId>org.jfrog.buildinfo</groupId>
809+
<artifactId>artifactory-maven-plugin</artifactId>
810+
<version>3.4.0</version>
811+
<executions>
812+
<execution>
813+
<id>build-info</id>
814+
<goals>
815+
<goal>publish</goal>
816+
</goals>
817+
<configuration>
818+
<artifactory>
819+
<includeEnvVars>false</includeEnvVars>
820+
</artifactory>
821+
<publisher>
822+
<contextUrl>{{artifactory.server}}</contextUrl>
823+
<username>{{artifactory.username}}</username>
824+
<password>{{artifactory.password}}</password>
825+
<repoKey>{{artifactory.staging-repository}}</repoKey>
826+
<snapshotRepoKey>{{artifactory.staging-repository}}</snapshotRepoKey>
827+
</publisher>
828+
<buildInfo>
829+
<buildName>{{artifactory.build-name}}</buildName>
830+
<buildNumber>{{artifactory.build-number}}</buildNumber>
831+
<buildUrl>{{BUILD_URL}}</buildUrl>
832+
</buildInfo>
833+
</configuration>
834+
</execution>
835+
</executions>
836+
</plugin>
837+
838+
</plugins>
839+
</pluginManagement>
840+
841+
<plugins>
842+
843+
<plugin>
844+
<groupId>org.jfrog.buildinfo</groupId>
845+
<artifactId>artifactory-maven-plugin</artifactId>
846+
</plugin>
847+
848+
</plugins>
849+
850+
</build>
851+
</profile>
787852
</profiles>
788853

789854
<pluginRepositories>

settings.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
4+
https://maven.apache.org/xsd/settings-1.0.0.xsd">
5+
6+
<servers>
7+
<server>
8+
<id>spring-plugins-release</id>
9+
<username>${env.ARTIFACTORY_USR}</username>
10+
<password>${env.ARTIFACTORY_PSW}</password>
11+
</server>
12+
<server>
13+
<id>spring-libs-snapshot</id>
14+
<username>${env.ARTIFACTORY_USR}</username>
15+
<password>${env.ARTIFACTORY_PSW}</password>
16+
</server>
17+
<server>
18+
<id>spring-libs-milestone</id>
19+
<username>${env.ARTIFACTORY_USR}</username>
20+
<password>${env.ARTIFACTORY_PSW}</password>
21+
</server>
22+
<server>
23+
<id>spring-libs-release</id>
24+
<username>${env.ARTIFACTORY_USR}</username>
25+
<password>${env.ARTIFACTORY_PSW}</password>
26+
</server>
27+
</servers>
28+
29+
</settings>

spring-vault-dependencies/pom.xml

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227

228228
<distributionManagement>
229229
<repository>
230-
<id>repo.spring.io</id>
230+
<id>spring-libs-milestone</id>
231231
<name>Spring Milestone Repository</name>
232232
<url>https://repo.spring.io/libs-milestone-local</url>
233233
</repository>
@@ -283,6 +283,71 @@
283283
</build>
284284

285285
</profile>
286+
287+
<profile>
288+
289+
<id>artifactory</id>
290+
291+
<distributionManagement>
292+
<repository>
293+
<id>spring-libs-snapshot</id>
294+
<name>Spring Snapshot Repository</name>
295+
<url>https://repo.spring.io/libs-snapshot-local</url>
296+
</repository>
297+
</distributionManagement>
298+
299+
<build>
300+
301+
<pluginManagement>
302+
<plugins>
303+
304+
<!-- Deploy to Artifactory -->
305+
306+
<plugin>
307+
<groupId>org.jfrog.buildinfo</groupId>
308+
<artifactId>artifactory-maven-plugin</artifactId>
309+
<version>3.4.0</version>
310+
<executions>
311+
<execution>
312+
<id>build-info</id>
313+
<goals>
314+
<goal>publish</goal>
315+
</goals>
316+
<configuration>
317+
<artifactory>
318+
<includeEnvVars>false</includeEnvVars>
319+
</artifactory>
320+
<publisher>
321+
<contextUrl>{{artifactory.server}}</contextUrl>
322+
<username>{{artifactory.username}}</username>
323+
<password>{{artifactory.password}}</password>
324+
<repoKey>{{artifactory.staging-repository}}</repoKey>
325+
<snapshotRepoKey>{{artifactory.staging-repository}}</snapshotRepoKey>
326+
</publisher>
327+
<buildInfo>
328+
<buildName>{{artifactory.build-name}}</buildName>
329+
<buildNumber>{{artifactory.build-number}}</buildNumber>
330+
<buildUrl>{{BUILD_URL}}</buildUrl>
331+
</buildInfo>
332+
</configuration>
333+
</execution>
334+
</executions>
335+
</plugin>
336+
337+
</plugins>
338+
</pluginManagement>
339+
340+
<plugins>
341+
342+
<plugin>
343+
<groupId>org.jfrog.buildinfo</groupId>
344+
<artifactId>artifactory-maven-plugin</artifactId>
345+
</plugin>
346+
347+
</plugins>
348+
349+
</build>
350+
</profile>
286351
</profiles>
287352

288353
</project>

0 commit comments

Comments
 (0)