-
Notifications
You must be signed in to change notification settings - Fork 0
/
JenkinsfileDeclarativeAug2021
88 lines (62 loc) · 1.58 KB
/
JenkinsfileDeclarativeAug2021
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
85
86
87
88
pipeline{
agent any
tools{
maven "maven3.6.2"
}
options{
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5'))
timestamps()
}
triggers{
//Poll SCM
pollSCM('* * * * *')
//Build Periodically
cron('* * * * *')
//GitHubWeb hook
githubPush()
}
stages{
stage('CheckoutCode'){
steps{
git branch: 'development', credentialsId: 'dd65bff1-b7fd-4c5b-9bc9-6c274df50095', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git'
}
}
stage('Build'){
steps{
sh "mvn clean package"
}
}
stage('ExecuteSonarQubeReport'){
steps{
sh "mvn sonar:sonar"
}
}
stage('UploadArtifactsintoNexusRepo'){
steps{
sh "mvn clean deploy"
}
}
stage('DeployAppintoTomcatServer')
{
steps{
sshagent(['b07d0aa5-2bef-49a7-9d56-940e56b6ba93']) {
sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war [email protected]:/opt/apache-tomcat-9.0.53/webapps"
}
}
}
}//Steps Closing
post{
success{
mail bcc: '[email protected]', body: '''Build Success..
Regards,
Mithun Technologies,
9980923226''', cc: '[email protected]', from: '', replyTo: '', subject: 'Build Success !!', to: '[email protected]'
}
failure{
mail bcc: '[email protected]', body: '''Build Failed..
Regards,
Mithun Technologies,
9980923226''', cc: '[email protected]', from: '', replyTo: '', subject: 'Build Failed !!', to: '[email protected]'
}
}
}//Pipeline Closing