-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
46 lines (39 loc) · 1.37 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
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Build'
sh "mvn --batch-mode package"
}
}
stage('Archive Unit Tests Results') {
steps {
echo 'Archive Unit Test Results'
step([$class: 'JUnitResultArchiver', testResults: 'target/surefire-reports/TEST-*.xml'])
}
}
stage('Publish Unit Test results report') {
steps {
echo 'Report'
publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: false, reportDir: 'target/site/jacoco/', reportFiles: 'index.html', reportName: 'jacaco report', reportTitles: ''])
}
}
stage('Deploy') {
steps {
echo 'Deploy'
sh '''
for runName in `docker ps | grep "alpine-petclinic" | awk '{print $1}'`
do
if [ "$runName" != "" ]
then
docker stop $runName
fi
done
docker build -t alpine-petclinic -f Dockerfile.deploy .
docker run --name alpine-petclinic --rm -d -p 9966:8080 alpine-petclinic
'''
}
}
}
}