diff --git a/Jenkinsfile b/Jenkinsfile index 1695ba6a4b..b56b35de9e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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' @@ -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" + } } } } - - } }