jenkins pipeline 写法

pipeline {
   agent any

   stages {
        stage('合服') {
           steps {
                sh '''
                    sh /data/fytx_hefuceshi_s005a/script/hefu/jenkin_script.bak/merge.sh
                '''
            }
        }
        stage('重启后台游戏服') {
            input {
                message "是否修改了后台配置?"
                ok "已修改"
                submitter "root,majunjie"
            }
            steps {
                sh '''
                    ssh -o StrictHostKeyChecking=no root@10.21.210.105 \'PATH=/usr/local/python2.7/bin:$PATH ; cd /home/game_analys && sh uwsgi_reboot.sh && cd /home/game_service && sh uwsgi_reboot.sh\'
                    cd /data/fytx_hefuceshi_s005a/py_service && sh login_service.sh restart && sh pay_service.sh restart && \
                    cd /data/fytx_hefuceshi_s005a/server && ./start.sh
                  '''
            }
        }
        stage('还原') {
            input {
                message "测试完成,后台配置是否还原?"
                ok "已还原"
                submitter "root,majunjie"
            }
            steps {
                sh '''
                    ssh -o StrictHostKeyChecking=no root@10.21.210.105 'PATH=/usr/local/python2.7/bin:$PATH ;cd /home/game_analys && sh uwsgi_reboot.sh && cd /home/game_service && sh uwsgi_reboot.sh'
                    cd /data/fytx_hefuceshi_s005a/script/hefu/jenkin_script.bak/ && sh recover.sh
                '''
            }
        }
    }
}

 

posted @ 2021-10-18 17:30  chenjianwen  阅读(121)  评论(0编辑  收藏  举报