Skip to content

Commit

Permalink
Update Jenkinsfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jleetutorial authored Oct 26, 2017
1 parent ba80625 commit 6ce1604
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
pipeline {
agent any
stages{

parameters {
string(name: 'tomcat_dev', defaultValue: '35.166.210.154', description: 'Staging Server')
string(name: 'tomcat_prod', defaultValue: '34.209.233.6', description: 'Production Server')
}

triggers {
pollSCM('* * * * *')
}

stages{
stage('Build'){
steps {
sh 'mvn clean package'
Expand All @@ -12,31 +22,21 @@ pipeline {
}
}
}
stage ('Deploy to Staging'){
steps {
build job: 'Deploy-to-staging'
}
}

stage ('Deploy to Production'){
steps{
timeout(time:5, unit:'DAYS'){
input message:'Approve PRODUCTION Deployment?'
stage ('Deployments'){
parallel{
stage ('Deploy to Staging'){
steps {
sh "scp -i /home/jenkins/tomcat-demo.pem **/target/*.war ec2-user@${params.tomcat_dev}:/var/lib/tomcat7/webapps"
}
}

build job: 'Deploy-to-Prod'
}
post {
success {
echo 'Code deployed to Production.'
}

failure {
echo ' Deployment failed.'
stage ("Deploy to Production"){
steps {
sh "scp -i /home/jenkins/tomcat-demo.pem **/target/*.war ec2-user@${params.tomcat_prod}:/var/lib/tomcat7/webapps"
}
}
}
}


}
}

0 comments on commit 6ce1604

Please sign in to comment.