Attempt to deploy
This commit is contained in:
parent
f98ab2896b
commit
ae6a7a0ae1
29
Jenkinsfile
vendored
29
Jenkinsfile
vendored
@ -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'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user