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' } } }