forked from intelliqittrainings/maven
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeclarativePipeline3
112 lines (98 loc) · 3.51 KB
/
DeclarativePipeline3
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
106
107
108
109
110
111
112
pipeline
{
agent any
stages
{
stage('ContinuousDownload')
{
steps
{
script
{
try
{
git 'https://github.com/intelliqittrainings/maven.git'
}
catch(Exception e1)
{
mail bcc: '', body: 'Jenkins is unable to download from remote github', cc: '', from: '', replyTo: '', subject: 'Download failed', to: 'gitadmin@outlook.com'
exit(1)
}
}
}
}
stage('ContinuousBuild')
{
steps
{
script
{
try
{
sh label: '', script: 'mvn package'
}
catch(Exception e2)
{
mail bcc: '', body: 'Jenkins is unable to create an artifact from the code', cc: '', from: '', replyTo: '', subject: 'Build failed', to: 'developers@outlook.com'
exit(1)
}
}
}
}
stage('ContinuousDeployment')
{
steps
{
script
{
try
{
sh label: '', script: 'scp /home/ubuntu/.jenkins/workspace/DeclarativePipeline/webapp/target/webapp.war ubuntu@172.31.31.15:/var/lib/tomcat8/webapps/testwebapp.war'
}
catch(Exception e3)
{
mail bcc: '', body: 'Jenkins is unable to deploy into tomcat on the QaServers', cc: '', from: '', replyTo: '', subject: 'Deployment failed', to: 'middleware@outlook.com'
exit(1)
}
}
}
}
stage('ContinuousTesting')
{
steps
{
script
{
try
{
git 'https://github.com/intelliqittrainings/FunctionalTesting.git'
sh label: '', script: 'java -jar /home/ubuntu/.jenkins/workspace/DeclarativePipeline/testing.jar'
}
catch(Exception e4)
{
mail bcc: '', body: 'Functional testing of the app on QAServers failed', cc: '', from: '', replyTo: '', subject: 'Testing failed', to: 'testers@outlook.com'
exit(1)
}
}
}
}
stage('ContinuousDelivery')
{
steps
{
script
{
try
{
input message: 'Waiting for Approval!', submitter: 'naresh'
sh label: '', script: 'scp /home/ubuntu/.jenkins/workspace/DeclarativePipeline/webapp/target/webapp.war ubuntu@172.31.26.41:/var/lib/tomcat8/webapps/prodwebapp.war'
}
catch(Exception e5)
{
mail bcc: '', body: 'Unable to deploy into ProdServers', cc: '', from: '', replyTo: '', subject: 'Delivery failed', to: 'delevery@outlook.com'
}
}
}
}
}
}