-
Notifications
You must be signed in to change notification settings - Fork 0
/
JenkinsFile
45 lines (45 loc) · 1.34 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
node {
def mvnHome
stage('Prepare') {
git url: '[email protected]:keshavkummari/devops.git', branch: 'master'
mvnHome = tool 'maven'
}
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/*.jar'
}
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/)
}
}
stage('Deploy') {
sh 'curl -u admin:redhat@123 -T target/**.war "http://13.233.89.27:8080/manager/text/deploy?path=/devops&update=true"'
}
stage("Smoke Test"){
sh "curl --retry-delay 10 --retry 5 http://13.233.89.27:8080/devops"
}
stage('Artifacts') {
if (isUnix()) {
sh "'${mvnHome}/bin/mvn' -Dmaven.test.failure.ignore clean deploy"
} else {
bat(/"${mvnHome}\bin\mvn" -Dmaven.test.failure.ignore clean deploy/)
}
}
}