-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Expand file tree
/
Copy pathJenkinsfile
More file actions
84 lines (75 loc) · 1.89 KB
/
Jenkinsfile
File metadata and controls
84 lines (75 loc) · 1.89 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
76
77
78
79
80
81
82
83
84
pipeline
{
agent any
tools
{
maven 'Maven_3.8.2'
}
triggers
{
pollSCM('* * * * *')
}
options
{
timestamps()
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5'))
}
stages
{
stage('Checkout Code from GitHub')
{
steps()
{
git branch: 'development', credentialsId: '957b543e-6f77-4cef-9aec-82e9b0230975', url: 'https://github.com/devopstrainingblr/maven-web-application-1.git'
}
}
stage('Build Project')
{
steps()
{
sh "mvn clean package"
}
}
stage('Execute SonarQube Report')
{
steps()
{
sh "mvn clean sonar:sonar"
}
}
stage('Upload Artifacts to Sonatype Nexus')
{
steps()
{
sh "mvn clean deploy"
}
}
stage('Deploy Application to Tomcat')
{
steps()
{
sshagent(['bfe1b3c1-c29b-4a4d-b97a-c068b7748cd0'])
{
sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@35.154.190.162:/opt/apache-tomcat-9.0.50/webapps/"
}
}
}
}
post
{
success
{
emailext to: 'devopstrainingblr@gmail.com,mithuntechnologies@yahoo.com',
subject: "Pipeline Build is Over Build # is ${env.BUILD_NUMBER} and Build Status is ${currentBuild.result}",
body: "Pipeline Build is Over Build # is ${env.BUILD_NUMBER} and Build Status is ${currentBuild.result}",
replyTo: 'devopstrainingblr@gmail.com'
}
failure
{
emailext to: 'devopstrainingblr@gmail.com,mithuntechnologies@yahoo.com',
subject: "Pipeline Build is Over Build # is ${env.BUILD_NUMBER} and Build Status is ${currentBuild.result}",
body: "Pipeline Build is Over Build # is ${env.BUILD_NUMBER} and Build Status is ${currentBuild.result}",
replyTo: 'devopstrainingblr@gmail.com'
}
}
}