Skip to content

Commit fd0b799

Browse files
committed
add ci
1 parent 6b0b218 commit fd0b799

File tree

2 files changed

+43
-165
lines changed

2 files changed

+43
-165
lines changed

Jenkinsfile

Lines changed: 41 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,43 @@
1-
pipeline {
2-
agent none
3-
4-
triggers {
5-
pollSCM 'H/10 * * * *'
6-
upstream(upstreamProjects: "spring-data-commons/master", threshold: hudson.model.Result.SUCCESS)
7-
}
8-
9-
options {
10-
disableConcurrentBuilds()
11-
buildDiscarder(logRotator(numToKeepStr: '14'))
12-
}
13-
14-
stages {
15-
stage("test: baseline (jdk8)") {
16-
when {
17-
anyOf {
18-
branch 'master'
19-
not { triggeredBy 'UpstreamCause' }
20-
}
21-
}
22-
agent {
23-
docker {
24-
image 'adoptopenjdk/openjdk8:latest'
25-
label 'data'
26-
args '-u root -v /var/run/docker.sock:/var/run/docker.sock'
27-
// root but with no maven caching
28-
}
29-
}
30-
options { timeout(time: 30, unit: 'MINUTES') }
31-
steps {
32-
sh './accept-third-party-license.sh'
33-
sh 'mkdir -p /tmp/jenkins-home'
34-
sh 'chown -R 1001:1001 .'
35-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pci,all-dbs clean dependency:list test -Dsort -U -B'
36-
sh 'chown -R 1001:1001 .'
37-
}
38-
}
39-
40-
stage("Test other configurations") {
41-
when {
42-
anyOf {
43-
branch 'master'
44-
not { triggeredBy 'UpstreamCause' }
45-
}
46-
}
47-
parallel {
48-
stage("test: baseline (jdk11)") {
49-
agent {
50-
docker {
51-
image 'adoptopenjdk/openjdk11:latest'
52-
label 'data'
53-
args '-u root -v /var/run/docker.sock:/var/run/docker.sock'
54-
// root but with no maven caching
55-
}
56-
}
57-
options { timeout(time: 30, unit: 'MINUTES') }
58-
steps {
59-
sh './accept-third-party-license.sh'
60-
sh 'mkdir -p /tmp/jenkins-home'
61-
sh 'chown -R 1001:1001 .'
62-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pci,all-dbs,java11 clean dependency:list test -Dsort -U -B'
63-
sh 'chown -R 1001:1001 .'
64-
}
65-
}
66-
67-
stage("test: baseline (jdk13)") {
68-
agent {
69-
docker {
70-
image 'adoptopenjdk/openjdk13:latest'
71-
label 'data'
72-
args '-u root -v /var/run/docker.sock:/var/run/docker.sock'
73-
// root but with no maven caching
74-
}
75-
}
76-
options { timeout(time: 30, unit: 'MINUTES') }
77-
steps {
78-
sh './accept-third-party-license.sh'
79-
sh 'mkdir -p /tmp/jenkins-home'
80-
sh 'chown -R 1001:1001 .'
81-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pci,all-dbs,java11 clean dependency:list test -Dsort -U -B'
82-
sh 'chown -R 1001:1001 .'
83-
}
84-
}
85-
}
86-
}
87-
88-
stage('Release to artifactory') {
89-
when {
90-
anyOf {
91-
branch 'master'
92-
not { triggeredBy 'UpstreamCause' }
93-
}
94-
}
95-
agent {
96-
docker {
97-
image 'adoptopenjdk/openjdk8:latest'
98-
label 'data'
99-
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
100-
}
101-
}
102-
options { timeout(time: 20, unit: 'MINUTES') }
1+
#!/usr/bin/env groovy
1032

104-
environment {
105-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
106-
}
107-
108-
steps {
109-
sh 'mkdir -p /tmp/jenkins-home'
110-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pci,artifactory ' +
111-
'-Dartifactory.server=https://repo.spring.io ' +
112-
"-Dartifactory.username=${ARTIFACTORY_USR} " +
113-
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
114-
"-Dartifactory.staging-repository=libs-snapshot-local " +
115-
"-Dartifactory.build-name=spring-data-jdbc " +
116-
"-Dartifactory.build-number=${BUILD_NUMBER} " +
117-
'-Dmaven.test.skip=true clean deploy -U -B'
118-
}
119-
}
120-
121-
stage('Publish documentation') {
122-
when {
123-
branch 'master'
124-
}
125-
agent {
126-
docker {
127-
image 'adoptopenjdk/openjdk8:latest'
128-
label 'data'
129-
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
130-
}
131-
}
132-
options { timeout(time: 20, unit: 'MINUTES') }
133-
134-
environment {
135-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
136-
}
137-
138-
steps {
139-
sh 'mkdir -p /tmp/jenkins-home'
140-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pci,distribute ' +
141-
'-Dartifactory.server=https://repo.spring.io ' +
142-
"-Dartifactory.username=${ARTIFACTORY_USR} " +
143-
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
144-
"-Dartifactory.distribution-repository=temp-private-local " +
145-
'-Dmaven.test.skip=true clean deploy -U -B'
146-
}
147-
}
148-
}
149-
150-
post {
151-
changed {
152-
script {
153-
slackSend(
154-
color: (currentBuild.currentResult == 'SUCCESS') ? 'good' : 'danger',
155-
channel: '#spring-data-dev',
156-
message: "${currentBuild.fullDisplayName} - `${currentBuild.currentResult}`\n${env.BUILD_URL}")
157-
emailext(
158-
subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}",
159-
mimeType: 'text/html',
160-
recipientProviders: [[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']],
161-
body: "<a href=\"${env.BUILD_URL}\">${currentBuild.fullDisplayName} is reported as ${currentBuild.currentResult}</a>")
162-
}
163-
}
164-
}
3+
pipeline {
4+
agent any
5+
6+
options {
7+
buildDiscarder(logRotator(numToKeepStr: '30'))
8+
timeout(time: 20, unit: 'MINUTES')
9+
// disable default checkout for enabling tags (see step 'Checkout')
10+
skipDefaultCheckout()
11+
}
12+
13+
stages {
14+
stage('Clean') {
15+
steps {
16+
deleteDir()
17+
}
18+
}
19+
20+
stage('Checkout') {
21+
steps {
22+
// checkout with tags
23+
checkout([
24+
$class : 'GitSCM',
25+
branches : scm.branches,
26+
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
27+
extensions : [[$class: 'CloneOption', noTags: false, shallow: false, depth: 0, reference: ''], [$class: 'LocalBranch', localBranch: "**"]],
28+
userRemoteConfigs : scm.userRemoteConfigs,
29+
])
30+
}
31+
}
32+
33+
stage('Publish Artifact') {
34+
steps {
35+
sh "echo $BRANCH_NAME"
36+
sh """
37+
docker-compose -f docker-compose.jenkins.yml run -e BRANCH_NAME=$BRANCH_NAME -T java bash -c "./mvnw publish"
38+
"""
39+
}
40+
}
41+
}
16542
}
43+

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@
270270

271271
<repositories>
272272
<repository>
273-
<id>spring-libs-snapshot</id>
274-
<url>https://repo.spring.io/libs-snapshot</url>
273+
<id>blablacar-snapshot</id>
274+
<url>http://nexus.blbl.cr/nexus/content/repositories/snapshots</url>
275275
</repository>
276276
</repositories>
277277

0 commit comments

Comments
 (0)