diff --git a/Jenkinsfile b/Jenkinsfile index 252b5daac..73cd58e92 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,54 +4,7 @@ pipeline { stage('Build') { steps { echo 'Running build automation' - sh './mvnw package' - } - } - stage('Build Docker Image') { - when { - branch 'main' - } - steps { - script { - app = docker.build("sprientera/train-schedule") - app.inside { - sh 'echo $(curl localhost:8080)' - } - } - } - } - stage('Push Docker Image') { - when { - branch 'main' - } - steps { - script { - docker.withRegistry('https://registry.hub.docker.com', 'sprientera') { - app.push("${env.BUILD_NUMBER}") - app.push("latest") - } - } - } - } - stage ('DeployToProduction') { - when { - branch 'master' - } - steps { - input 'Deploy to Production' - milestone(1) - withCredentials ([usernamePassword(credentialsId: 'webserver_login', usernameVariable: '', passwordVariable: 'USERPASS')]) { - script { - sh "sshpass -p '$USERPASS' -v ssh -o StrictHostKeyChecking=no $USERNAME@${env.prod_ip} \"docker pull /train-schedule:${env.BUILD_NUMBER}\"" - try { - sh "sshpass -p '$USERPASS' -v ssh -o StrictHostKeyChecking=no $USERNAME@${env.prod_ip} \"docker stop train-schedule\"" - sh "sshpass -p '$USERPASS' -v ssh -o StrictHostKeyChecking=no $USERNAME@${env.prod_ip} \"docker rm train-schedule\"" - } catch (err) { - echo: 'caught error: $err' - } - sh "sshpass -p '$USERPASS' -v ssh -o StrictHostKeyChecking=no $USERNAME@${env.prod_ip} \"docker run --restart always --name train-schedule -p 8080:8080 -d /train-schedule:${env.BUILD_NUMBER}\"" - } - } + sh './mvnw package } } }