- 修改 sshagent 中的密钥 ID,从 'huawei68' 改为 '9333168e-6267-440b-9f24-87b29427e728' - 在 git pull 命令前添加 SSH 连接,确保远程服务器能够执行命令
32 lines
988 B
Plaintext
32 lines
988 B
Plaintext
pipeline {
|
|
agent any
|
|
stages {
|
|
stage('部署') {
|
|
steps {
|
|
echo 'Deploying...'
|
|
sshagent(['9333168e-6267-440b-9f24-87b29427e728']) {
|
|
sh "ssh root@121.37.155.68 'cd /mnt/data/docker/chuanqi-server-instance&&git pull'"
|
|
// sh 'docker restart chuanqi-server-logic'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
success {
|
|
echo 'Deployment finished successfully.'
|
|
sh """
|
|
curl 'https://api.telegram.org/bot7816434196:AAFtmbUYpUIwcb_SvBnJY0guPIOLCxp2a5s/sendMessage' \\
|
|
-x http://192.168.25.110:20171\\
|
|
-H 'Content-Type: application/json' \\
|
|
-d '{
|
|
"chat_id": "6779541681",
|
|
"text":"传奇服务端生产环境(pro)构建完成!",
|
|
}'
|
|
"""
|
|
}
|
|
failure {
|
|
echo 'Deployment failed.'
|
|
}
|
|
}
|
|
}
|