Skip to content

Commit 907e94a

Browse files
authored
Create JenkinsfileDeclarative
1 parent 6e3d33d commit 907e94a

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

JenkinsfileDeclarative

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
pipeline{
2+
3+
agent any
4+
5+
tools
6+
{
7+
maven 'maven3.6.3'
8+
9+
}
10+
11+
triggers{
12+
pollSCM('* * * * *')
13+
}
14+
15+
options{
16+
timestamps()
17+
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '2', daysToKeepStr: '', numToKeepStr: '2'))
18+
}
19+
20+
stages{
21+
22+
stage('CheckoutCode')
23+
{
24+
steps{
25+
git branch: 'development', credentialsId: '8e348aa2-9531-4dbe-863d-1adb64897470', url: 'https://github.com/LandmakTechnology/maven-web-application.git'
26+
}
27+
}
28+
29+
stage('Build')
30+
{
31+
steps{
32+
sh "mvn clean package"
33+
}
34+
}
35+
36+
stage('ExecuteSonarQubeReport')
37+
{
38+
steps{
39+
sh "mvn sonar:sonar"
40+
}
41+
}
42+
43+
stage('UploadArtifactintoNexus')
44+
{
45+
steps{
46+
sh "mvn deploy"
47+
}
48+
}
49+
50+
stage('DeployAppIntoTomcat')
51+
{
52+
steps{
53+
sshagent(['2b7b0c6a-5eff-4f4a-82c3-3630f91c70b5']) {
54+
sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war [email protected]:/opt/apache-tomcat-9.0.41/webapps/"
55+
}
56+
}
57+
}
58+
59+
60+
61+
}
62+
63+
post{
64+
65+
66+
success{
67+
mail bcc: '[email protected]', body: '''BuildOver!....
68+
69+
Regards,
70+
Landmark Technologies,
71+
9980923226''', cc: '[email protected]', from: '', replyTo: '', subject: 'BuildOver!!', to: '[email protected]'
72+
}
73+
74+
failure{
75+
mail bcc: '[email protected]', body: '''BuildOver!....
76+
77+
Regards,
78+
Landmark Technologies,
79+
+1 437 215 2483,''', cc: '[email protected]', from: '', replyTo: '', subject: 'BuildOver!!', to: '[email protected]'
80+
}
81+
82+
}
83+
}
84+
Footer
85+
© 2022 GitHub, Inc.

0 commit comments

Comments
 (0)