From 73cae85ab27bdcebba979850bbd67fd1fedcc8be Mon Sep 17 00:00:00 2001 From: tungnc2012 <69843523+tungnc2012@users.noreply.github.com> Date: Sun, 17 Oct 2021 22:26:58 +0700 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 700025c09..f0c4ed122 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { } steps { script { - app = docker.build("willbla/train-schedule") + app = docker.build("tungnc2012/train-schedule") app.inside { sh 'echo $(curl localhost:8080)' } @@ -34,26 +34,5 @@ pipeline { } } } - stage('DeployToProduction') { - when { - branch 'master' - } - steps { - input 'Deploy to Production?' - milestone(1) - withCredentials([usernamePassword(credentialsId: 'webserver_login', usernameVariable: 'USERNAME', passwordVariable: 'USERPASS')]) { - script { - sh "sshpass -p '$USERPASS' -v ssh -o StrictHostKeyChecking=no $USERNAME@$prod_ip \"docker pull willbla/train-schedule:${env.BUILD_NUMBER}\"" - try { - sh "sshpass -p '$USERPASS' -v ssh -o StrictHostKeyChecking=no $USERNAME@$prod_ip \"docker stop train-schedule\"" - sh "sshpass -p '$USERPASS' -v ssh -o StrictHostKeyChecking=no $USERNAME@$prod_ip \"docker rm train-schedule\"" - } catch (err) { - echo: 'caught error: $err' - } - sh "sshpass -p '$USERPASS' -v ssh -o StrictHostKeyChecking=no $USERNAME@$prod_ip \"docker run --restart always --name train-schedule -p 8080:8080 -d willbla/train-schedule:${env.BUILD_NUMBER}\"" - } - } - } - } } -} \ No newline at end of file +}