server Jenkinsfile

This commit is contained in:
luozhun 2024-10-31 15:23:30 +08:00
parent 8a32c77f4c
commit 10bcd21888
1 changed files with 13 additions and 1 deletions

View File

@ -34,9 +34,21 @@ pipeline {
} }
sshCommand remote: remote, command: 'pwd=$(pwd) echo "ssh连接成功当前工作目录$(pwd)"' sshCommand remote: remote, command: 'pwd=$(pwd) echo "ssh连接成功当前工作目录$(pwd)"'
sshCommand remote: remote, command: 'echo "停止后台服务..."'
sshCommand remote: remote, command: '''docker stop policeSecurityServer'''
sshCommand remote: remote, command: 'echo "后台服务已停止..."'
sshCommand remote: remote, command: 'echo "删除原来的server.jar..."'
sshRemove remote: remote, path: '/home/javaProject/policeSecurity/policeSecurityServer.jar'
sshCommand remote: remote, command: 'echo "server.jar删除成功!"'
sshCommand remote: remote, command: 'echo "将构建的server.jar发送到服务器..."' sshCommand remote: remote, command: 'echo "将构建的server.jar发送到服务器..."'
sshPut remote: remote, from: '/var/jenkins_home/workspace/警保联动后端服务/policeSecurityServer/target/policeSecurityServer.jar', into: '/home/javaProject/policeSecurity/logs' sshPut remote: remote, from: '/var/jenkins_home/workspace/警保联动后端服务/policeSecurityServer/target/policeSecurityServer.jar', into: '/home/javaProject/policeSecurity'
sshCommand remote: remote, command: 'echo "server.jar发送成功!"' sshCommand remote: remote, command: 'echo "server.jar发送成功!"'
sshCommand remote: remote, command: 'echo "启动后台服务..."'
sshCommand remote: remote, command: '''docker start policeSecurityServer'''
sshCommand remote: remote, command: 'echo "后台服务启动成功!"'
} }
} }
} }