-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsFile
More file actions
75 lines (62 loc) · 1.6 KB
/
JenkinsFile
File metadata and controls
75 lines (62 loc) · 1.6 KB
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
node {
def mvnHome
def pom
def artifactVersion
def tagVersion
def retrieveArtifact
stage('Prepare') {
mvnHome = tool 'maven'
}
stage('Checkout') {
checkout scm
}
stage('Build') {
if (isUnix()) {
sh "'${mvnHome}/bin/mvn' -Dmaven.test.failure.ignore clean package"
} else {
bat(/"${mvnHome}\bin\mvn" -Dmaven.test.failure.ignore clean package/)
}
}
stage('Unit Test') {
junit '**/target/surefire-reports/TEST-*.xml'
archive 'target/*.war'
}
stage('Integration Test') {
if (isUnix()) {
sh "'${mvnHome}/bin/mvn' -Dmaven.test.failure.ignore clean verify"
} else {
bat(/"${mvnHome}\bin\mvn" -Dmaven.test.failure.ignore clean verify/)
}
}
stage('Sonar') {
if (isUnix()) {
sh "'${mvnHome}/bin/mvn' sonar:sonar"
} else {
bat(/"${mvnHome}\bin\mvn" sonar:sonar/)
}
}
if(env.BRANCH_NAME == 'master'){
stage('Validate Build Post Prod Release') {
if (isUnix()) {
sh "'${mvnHome}/bin/mvn' clean package"
} else {
bat(/"${mvnHome}\bin\mvn" clean package/)
}
}
}
if(env.BRANCH_NAME == 'develop'){
stage('Snapshot Build And Upload Artifacts') {
if (isUnix()) {
sh "'${mvnHome}/bin/mvn' clean deploy"
} else {
bat(/"${mvnHome}\bin\mvn" clean deploy/)
}
}
stage('Deploy') {
sh 'curl -u jenkins:jenkins -T target/**.war "http://localhost:8080/manager/text/deploy?path=/devops&update=true"'
}
stage("Smoke Test"){
sh "curl --retry-delay 10 --retry 5 http://localhost:8080/devops"
}
}
}