mirror of
https://github.com/simon987/music-graph-ui.git
synced 2025-04-10 14:06:41 +00:00
42 lines
1.3 KiB
Groovy
42 lines
1.3 KiB
Groovy
def remote = [:]
|
|
remote.name = 'remote'
|
|
remote.host = env.DEPLOY_HOST
|
|
remote.user = env.DEPLOY_USER
|
|
remote.identityFile = '/var/lib/jenkins/.ssh/id_rsa'
|
|
remote.knownHosts = '/var/lib/jenkins/.ssh/known_hosts'
|
|
remote.allowAnyHosts = true
|
|
remote.retryCount = 3
|
|
remote.retryWaitSec = 3
|
|
logLevel = 'FINER'
|
|
|
|
pipeline {
|
|
stages {
|
|
stage('Build') {
|
|
agent {
|
|
docker {
|
|
image 'node:10-alpine'
|
|
args '--network "host"'
|
|
}
|
|
}
|
|
steps {
|
|
sh 'cd music_graph/ && npm install && npm audit fix && npm run build'
|
|
sh 'mv music_graph/dist webroot'
|
|
stash includes: 'webroot/', name: 'webdist'
|
|
}
|
|
}
|
|
stage('Deploy') {
|
|
agent none
|
|
steps {
|
|
node('master') {
|
|
unstash 'webdist'
|
|
sshCommand remote: remote, command: "cd simon987 && rm -rf webroot/* deploy.sh"
|
|
sshPut remote: remote, from: 'webroot/', into: 'music-graph'
|
|
sshPut remote: remote, from: 'jenkins/deploy.sh', into: 'music-graph/'
|
|
sshCommand remote: remote, command: 'chmod +x music-graph/deploy.sh && ./music-graph/deploy.sh'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|