forked from johnpapa/node-hello
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile
More file actions
23 lines (22 loc) · 744 Bytes
/
Jenkinsfile
File metadata and controls
23 lines (22 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
pipeline {
agent any
stages {
stage('gitclone') {
steps {
git 'https://github.com/barathtech/hello-world.git'
sh 'rm -rf .git'
}
}
stage('Deploy') {
steps{
sshagent(['ssh-key']) {
sh """
scp -o StrictHostKeyChecking=no -r ${env.WORKSPACE}/* root@10.0.138.24:/var/www/html/${env.JOB_BASE_NAME}
[ -f ".env" ] && scp .env root@10.0.138.24/var/www/html/${env.JOB_BASE_NAME}
ssh -o StrictHostKeyChecking=no root@10.0.138.24 pm2 restart ${env.JOB_BASE_NAME}
"""
}
}
}
}
}