beartrack-api/Jenkinsfile

48 lines
1.8 KiB
Groovy

pipeline {
agent {label 'html'}
stages {
stage('Check host') {
steps {
withCredentials(bindings: [sshUserPrivateKey(credentialsId: '301d16da-51e4-438d-abf7-51b88a05bcec', \
keyFileVariable: 'SSH_KEY_PEREC', usernameVariable: 'SSH_USERNAME')]) {
sh '''
ssh -i $SSH_KEY_PEREC -o StrictHostKeyChecking=no $SSH_USERNAME@172.16.0.22 "freebsd-version"
'''
}
}
}
stage('Deploy site rsync') {
steps {
withCredentials(bindings: [sshUserPrivateKey(credentialsId: '301d16da-51e4-438d-abf7-51b88a05bcec', \
keyFileVariable: 'SSH_KEY_PEREC', usernameVariable: 'SSH_USERNAME')]) {
sh '''
rsync -avz --delete -e "ssh -i $SSH_KEY_PEREC -o StrictHostKeyChecking=no" src/ $SSH_USERNAME@172.16.0.22:/home/$SSH_USERNAME/site/web_example_static/
'''
}
}
}
// stage ('Deploy site ssh){
// steps {
// withCredentials(bindings: [sshUserPrivateKey(credentialsId: '301d16da-51e4-438d-abf7-51b88a05bcec', \
// keyFileVariable: 'SSH_KEY_PEREC', usernameVariable: 'SSH_USERNAME')]) {
// sh '''
// scp -rp -i $SSH_KEY_PEREC -o StrictHostKeyChecking=no src/* $SSH_USERNAME@172.16.0.22:/home/$SSH_USERNAME/site/web_example_static/
// '''
// }
// }
// }
}
// post{
// success {
// echo "success"
// }
// failure {
// echo "failure"
// }
// }
}