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