-
Notifications
You must be signed in to change notification settings - Fork 18
/
Jenkinsfile
24 lines (23 loc) · 878 Bytes
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
pipeline {
agent any
environment {
CI = 'true'
}
stages {
stage('Deploy for production') {
when {
branch 'master'
}
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'servercredential', keyFileVariable: 'KEY', passphraseVariable: 'PASSPHRASE', usernameVariable: 'USERNAME'), string(credentialsId: 'myserverip', variable: 'IP')]) {
echo 'Sync...'
sh 'rsync -avrt --delete --exclude \'.git\' --rsh=\'ssh -p 22\' ./ $USERNAME@$IP:/$USERNAME/react-pwa-id.rizalibnu.com/'
echo 'Build Docker...'
sh '''
ssh -t -i "$KEY" "$USERNAME"@"$IP" -p 22 "cd /$USERNAME/react-pwa-id.rizalibnu.com && sh start.sh"
'''
}
}
}
}
}