forked from intelliqittrainings/maven
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pipleine_try_catc
101 lines (99 loc) · 2.46 KB
/
Pipleine_try_catc
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
89
90
91
92
93
94
95
96
97
98
99
100
101
pipeline
{
agent any
stages
{
stage('ContDownload')
{
steps
{
script
{
try
{
git 'https://github.com/intelliqittrainings/maven.git'
}
catch(Exception e1)
{
mail bcc: '', body: 'Jenkins is unable to download from github', cc: '', from: '', replyTo: '', subject: 'Download issue', to: 'git_admin@gmail.com'
exit(1);
}
}
}
}
stage('ContBuild')
{
steps
{
script
{
try
{
sh label: '', script: 'mvn package'
}
catch(Exception e2)
{
mail bcc: '', body: 'Jenkins is unable to create an artifact', cc: '', from: '', replyTo: '', subject: 'Build issue', to: 'developers@gmail.com'
exit(1);
}
}
}
}
stage('ContDeployment')
{
steps
{
script
{
try
{
sh label: '', script: 'scp /var/lib/jenkins/workspace/DeclarativePipeline/webapp/target/webapp.war ubuntu@172.31.36.247:/var/lib/tomcat8/webapps/newtest1.war'
}
catch(Exception e3)
{
mail bcc: '', body: 'Jenkins is unable to deploy into the QAServers', cc: '', from: '', replyTo: '', subject: 'Deployment issue', to: 'middleware@gmail.com'
exit(1);
}
}
}
}
stage('ContTesting')
{
steps
{
script
{
try
{
git 'https://github.com/selenium-saikrishna/FunctionalTesting.git'
sh label: '', script: 'echo "Testing Passed"'
}
catch(Exception e4)
{
mail bcc: '', body: 'Functional Testing has failed', cc: '', from: '', replyTo: '', subject: 'Testingt issue', to: 'testers@gmail.com'
exit(1);
}
}
}
}
}
stage('ContDelivery')
{
steps
{
script
{
try
{
sh label: '', script: 'scp /var/lib/jenkins/workspace/DeclarativePipeline/webapp/target/webapp.war ubuntu@172.31.35.219:/var/lib/tomcat8/webapps/prod.war'
}
catch(Exception e5)
{
mail bcc: '', body: 'Jenkins is unable to deploy into prod servers', cc: '', from: '', replyTo: '', subject: 'Delivery issue', to: 'delivery@gmail.com'
exit(1);
}
}
}
}
}
}