psniquiz/Jenkinsfile

19 lines
585 B
Plaintext
Raw Normal View History

2024-09-26 18:37:24 +03:00
pipeline {
agent any
2024-09-26 20:17:28 +03:00
environment {
withCredentials([usernamePassword(credentialsId: 'QuizServerCreds', usernameVariable: 'USERNAME', passwordVariable: 'SERVER_IP')]) {
SERVER_USERNAME = "${USERNAME}"
SERVER_IP = "${SERVER_IP}"
}
}
2024-09-26 18:37:24 +03:00
stages {
2024-09-26 20:17:28 +03:00
stage('Copy Files on Server') {
2024-09-26 18:37:24 +03:00
steps {
2024-09-26 20:17:28 +03:00
sh 'ssh-keyscan ${SERVER_IP} > ~/.ssh/known_hosts'
2024-09-26 20:19:40 +03:00
sh 'rsync -avzhe --exclude "Jenkinsfile" ssh * ${SERVER_USERNAME}@${SERVER_IP}:/var/www/public_html'
2024-09-26 18:37:24 +03:00
}
}
}
}