From af78bd71c7225f2dc156c00588b6691e4bbe342e Mon Sep 17 00:00:00 2001 From: Araozu Date: Wed, 8 Nov 2023 06:21:04 -0500 Subject: [PATCH] jenkinsfile 2 episode 1 --- Jenkinsfile.groovy | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index 4359d3b..80ace03 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -20,16 +20,18 @@ pipeline { PATH = "/var/lib/jenkins/.nvm/versions/node/v20.9.0/bin:${env.PATH}" } steps { - dir('/var/www/jerguero') { - // Remove previous deploy - sh 'rm /var/www/jerguero/*' - // Copy new deploy - sh 'cp /var/lib/jenkins/workspace/jerguero/target/jerguero-0.0.1.jar /var/www/jerguero' - // run jar with pm2 - sh "pm2 start jerguero-0.0.1.jar --name ${env.JOB_NAME}" - // Save state - sh 'pm2 save' - } + // Remove previous deploy + sh 'rm /var/www/jerguero/* || true' + // Copy new deploy + sh 'cp /var/lib/jenkins/workspace/jerguero/target/jerguero-0.0.1.jar /var/www/jerguero' + sh 'whoami' + // Change directory + // dir('/var/www/jerguero') { + // run jar with pm2 + sh "pm2 start /var/www/jerguero/jerguero-0.0.1.jar --name ${env.JOB_NAME}" + // Save state + sh 'pm2 save' + // } } } }