Jenkins 管道脚本返回退出代码 3

时间:2021-04-30 04:39:45

标签: bash shell jenkins

同时使用并行管道在 shell 脚本中获取退出代码 3。

stage('Core:Restart')
{ agent { label "master" } 
    steps { 
        wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[password: "${password}"]]]) 
        { sh label: '', 
            script: '''#!/bin/bash
            if [[ -z ${CORE_BRANCH} ]] then
                echo "You have entered empty branch for CORE Module" 
            else
                for ip in ${CORE_SERVER_IP//,/ }; do 
                    echo "$ip" 
                    sshpass -p $password ssh -o StrictHostKeyChecking=no -tt ${USER}@${ip} <<EOF
                        set -e 
                        sudo -i
                        set -e 
                        /etc/init.d/tomcat status 
                        exit 0 
                        exit 0 
EOF 
                done
            fi''' 
        } 
    } 
} 

分享以下快照作为额外参考。 Jenkins option

0 个答案:

没有答案
相关问题