File tree Expand file tree Collapse file tree 1 file changed +21
-21
lines changed Expand file tree Collapse file tree 1 file changed +21
-21
lines changed Original file line number Diff line number Diff line change 11pipeline {
22 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{
414 stage(' Build' ){
515 steps {
616 sh ' mvn clean package'
@@ -12,31 +22,21 @@ pipeline {
1222 }
1323 }
1424 }
15- stage (' Deploy to Staging' ){
16- steps {
17- build job : ' Deploy-to-staging'
18- }
19- }
2025
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+ }
2532 }
2633
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+ }
3638 }
3739 }
3840 }
39-
40-
4141 }
4242}
You can’t perform that action at this time.
0 commit comments