Skip to content

Commit

Permalink
ci: wrap remote update steps in remote script and deploy on master only
Browse files Browse the repository at this point in the history
Executing the Steps via sshCommand was too error prone for me at the moment.

#30
  • Loading branch information
Mytlogos committed Oct 19, 2020
1 parent ccf36f7 commit 2e39022
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ pipeline {
}

stage("Deploy production") {
// deploy from master only
when {
branch 'master'
}
environment {
GH_TOKEN = credentials('e2d21e2c-c919-4137-9355-21e4602a862e')
}
Expand All @@ -69,14 +73,9 @@ pipeline {
remote.password = ssh_pw
}
}
sshCommand remote: remote, command: 'cd $ENTERPRISE_DIR'
sshCommand remote: remote, command: 'git pull'
// do not install depencies listed under devDependecies
sshCommand remote: remote, command: 'npm install --production'
// download the latest dist directory
sshCommand remote: remote, command: 'node src/server/bin/update.js'
// restart pm2 managed process
sshCommand remote: remote, command: 'pm2 restart ecosystem.config.js'
// execute a remote script which does all the necessary deploy steps
// TODO: put the script in git
sshCommand remote: remote, command: './update-enterprise.sh'
}
}
}
Expand Down

0 comments on commit 2e39022

Please sign in to comment.