-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeclarativePipeline2
105 lines (98 loc) · 3.39 KB
/
DeclarativePipeline2
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
102
103
104
105
pipeline
{
agent any
stages
{
stage('ContinousDownload')
{
steps
{
script
{
try
{
git 'https://github.com/intelliqittrainings/maven.git'
}
catch(Exception e1)
{
mail bcc: '', body: 'Jenkins is not able to download from the remote git repo', cc: '', from: '', replyTo: '', subject: 'Unable to Download from github', to: '[email protected]'
exit(1);
}
}
}
}
stage('ContinousBuild')
{
steps
{
script
{
try
{
sh label: '', script: 'mvn package'
}
catch(Exception e2)
{
mail bcc: '', body: 'Jenkins is not able to create an artifact using maven', cc: '', from: '', replyTo: '', subject: 'Build failed', to: '[email protected]'
exit(1);
}
}
}
}
stage('ContinousDeployment')
{
steps
{
script
{
try
{
sh label: '', script: 'scp /home/ubuntu/.jenkins/workspace/DeclarativePipeline/webapp/target/webapp.war [email protected]:/var/lib/tomcat8/webapps/testapp.war'
}
catch(Exception e3)
{
mail bcc: '', body: 'Jenkins is not able to deploy into tomcat on the QAServers', cc: '', from: '', replyTo: '', subject: 'Deployment Failed', to: '[email protected]'
exit(1);
}
}
}
}
stage('ContinousTesting')
{
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: 'TestingFailed', to: '[email protected]'
exit(1);
}
}
}
}
stage('ContinousDelivery')
{
steps
{
script
{
try
{
sh label: '', script: 'scp /home/ubuntu/.jenkins/workspace/DeclarativePipeline/webapp/target/webapp.war [email protected]:/var/lib/tomcat8/webapps/prodapp.war'
}
catch(Exception e5)
{
mail bcc: '', body: 'Jenkins is not able to deploy into production servers', cc: '', from: '', replyTo: '', subject: 'Delivery Failed', to: '[email protected]'
exit(1);
}
}
}
}
}
}