Skip to content

Commit 6ce1604

Browse files
authored
Update Jenkinsfile
1 parent ba80625 commit 6ce1604

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

Jenkinsfile

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
pipeline {
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
}

0 commit comments

Comments
 (0)