forked from spring-projects/spring-petclinic
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Jenkinsfile
96 lines (92 loc) · 2.16 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
pipeline {
agent { label 'docker' }
stages {
stage('Build') {
agent {
docker {
image 'maven:3.3.9'
reuseNode true
}
}
steps {
sh 'mvn -B clean package -DskipTests=true findbugs:findbugs'
}
post {
success {
step([$class: 'FindBugsPublisher', pattern: 'target/findbugsXml.xml', unHealthy: ''])
}
}
}
stage('Test') {
agent {
docker {
image 'maven:3.3.9'
reuseNode true
}
}
when {
branch '**/master'
}
steps {
sh 'mvn -B clean package -Pintegration'
}
post {
always {
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true, allowEmptyArchive: true
}
success {
junit '**/target/surefire-reports/TEST-*.xml'
}
unstable {
junit '**/target/surefire-reports/TEST-*.xml'
}
}
}
stage('Release Test') {
agent {
docker {
image 'maven:3.3.9'
reuseNode true
}
}
when {
branch '**/release-*'
}
steps {
sh "mvn -B clean package -Prelease -Dversion='${env.BRANCH_NAME.drop(env.BRANCH_NAME.lastIndexOf('-')+1)}.$BUILD_NUMBER'"
}
post {
always {
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true, allowEmptyArchive: true
}
success {
junit '**/target/surefire-reports/TEST-*.xml'
}
unstable {
junit '**/target/surefire-reports/TEST-*.xml'
}
}
}
stage('Release Push') {
when {
expression {
env.BRANCH_NAME.contains('release-') && currentBuild.result == null
}
}
environment {
REL = credentials('ssh-bob')
}
steps {
dir('target') {
sh '../perform-release.sh -user $REL_USR -password $REL_PSW'
}
}
post {
success {
//mail subject: 'Bits released', body: 'Happy days!', from: '[email protected]', to: '[email protected]'
echo "Sending email"
}
}
}
}
}