File tree 1 file changed +21
-21
lines changed
1 file changed +21
-21
lines changed Original file line number Diff line number Diff line change 1
1
pipeline {
2
2
agent any
3
- stages{
3
+
4
+ parameters {
5
+ string(name : ' tomcat_dev' , defaultValue : ' 35.166.210.154' , description : ' Staging Server' )
6
+ string(name : ' tomcat_prod' , defaultValue : ' 34.209.233.6' , description : ' Production Server' )
7
+ }
8
+
9
+ triggers {
10
+ pollSCM(' * * * * *' )
11
+ }
12
+
13
+ stages{
4
14
stage(' Build' ){
5
15
steps {
6
16
sh ' mvn clean package'
@@ -12,31 +22,21 @@ pipeline {
12
22
}
13
23
}
14
24
}
15
- stage (' Deploy to Staging' ){
16
- steps {
17
- build job : ' Deploy-to-staging'
18
- }
19
- }
20
25
21
- stage (' Deploy to Production' ){
22
- steps{
23
- timeout(time :5 , unit :' DAYS' ){
24
- input message :' Approve PRODUCTION Deployment?'
26
+ stage (' Deployments' ){
27
+ parallel{
28
+ stage (' Deploy to Staging' ){
29
+ steps {
30
+ sh " scp -i /home/jenkins/tomcat-demo.pem **/target/*.war ec2-user@${ params.tomcat_dev} :/var/lib/tomcat7/webapps"
31
+ }
25
32
}
26
33
27
- build job : ' Deploy-to-Prod'
28
- }
29
- post {
30
- success {
31
- echo ' Code deployed to Production.'
32
- }
33
-
34
- failure {
35
- echo ' Deployment failed.'
34
+ stage (" Deploy to Production" ){
35
+ steps {
36
+ sh " scp -i /home/jenkins/tomcat-demo.pem **/target/*.war ec2-user@${ params.tomcat_prod} :/var/lib/tomcat7/webapps"
37
+ }
36
38
}
37
39
}
38
40
}
39
-
40
-
41
41
}
42
42
}
You can’t perform that action at this time.
0 commit comments