Skip to content

Commit 06c9e91

Browse files
Create JenkinsfileSjDeclarative
1 parent 9e8f0e3 commit 06c9e91

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

JenkinsfileSjDeclarative

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
pipeline{
2+
3+
agent any;
4+
5+
tools{
6+
maven 'maven3.6.2'
7+
8+
}
9+
10+
triggers{
11+
pollSCM('* * * * *')
12+
}
13+
14+
options{
15+
timestamps()
16+
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5'))
17+
}
18+
19+
stages{
20+
21+
stage('CheckOutCode'){
22+
steps{
23+
24+
git branch: 'development', credentialsId: 'abced4b2-40e3-4849-90fa-6b09ebe6cc39', url: 'https://github.com/soujanyagutta/maven-web-application.git'
25+
}
26+
}
27+
28+
stage('Build'){
29+
steps{
30+
sh "mvn clean package"
31+
}
32+
}
33+
/*
34+
stage('ExecuteSonarQubeReport'){
35+
steps{
36+
sh "mvn clean sonar:sonar"
37+
}
38+
}
39+
40+
stage('UploadArtifactsIntoNexus'){
41+
steps{
42+
sh "mvn clean deploy"
43+
}
44+
}
45+
46+
stage('DeployAppIntoTomcat'){
47+
steps{
48+
sshagent(['ad569ef3-1eca-4192-a161-4ce1320490e1']) {
49+
sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war [email protected]:/opt/apache-tomcat-9.0.50/webapps/”
50+
51+
52+
}
53+
}
54+
}
55+
/*
56+
}//Stages Closing
57+
58+
post{
59+
60+
success{
61+
62+
63+
subject: "Pipeline Build is over .. Build # is ..${env.BUILD_NUMBER} and Build status is.. ${currentBuild.result}.",
64+
body: "Pipeline Build is over .. Build # is ..${env.BUILD_NUMBER} and Build status is.. ${currentBuild.result}.",
65+
replyTo: '[email protected]'
66+
}
67+
68+
failure{
69+
70+
71+
subject: "Pipeline Build is over .. Build # is ..${env.BUILD_NUMBER} and Build status is.. ${currentBuild.result}.",
72+
body: "Pipeline Build is over .. Build # is ..${env.BUILD_NUMBER} and Build status is.. ${currentBuild.result}.",
73+
replyTo: '[email protected]'
74+
}
75+
76+
}
77+
78+
79+
}//Pipeline closing
80+
• © 2021 GitHub, Inc.
81+

0 commit comments

Comments
 (0)