From ae6a7a0ae16187a08d8b1ba118900463723fbd4c Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Sun, 1 Jun 2025 21:27:22 +0100 Subject: [PATCH] Attempt to deploy --- Jenkinsfile | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 498d25e..dd02636 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,20 +31,23 @@ pipeline { } } - stage('Deploy') { + stage('Deploy to printer1') { steps { - echo 'Deploying application...' - sshagent(['printer1.tombutcher.local']) { - sh ''' - # Create backup of current build - if [ -d /path/to/app/build ]; then mv /path/to/app/build /path/to/app/build.backup; fi - - # Transfer new build - scp -r build/* /path/to/app/build/ - - # Restart the service - sudo systemctl restart your-service-name - ''' + script { + def remote = [ + name: 'printer1', + host: 'printer1.tombutcher.local', + user: 'ci', + port: 22, + credentialsId: 'ci_ssh', + allowAnyHosts: true + ] + + // Upload the build folder + sshPut remote: remote, from: 'build/', into: '/srv/farmcontrol-server/', flatten: false + + // Restart the service + sshCommand remote: remote, command: 'sudo /bin/systemctl restart farmcontrol-server.service' } } }