Jenkins声明式管道-即使一个阶段失败,也可以继续进行后续阶段

时间:2020-03-01 09:50:21

标签: jenkins jenkins-pipeline jenkins-groovy jenkins-cli

我处于低于阶段的状态,当该阶段失败时,该阶段必须为“暂停”,以便用户采取所需的措施来修复后端服务器上的问题。解决此问题后,当用户在输入消息中单击“确定”时,将执行下一阶段。但是在下面的代码中,当我在输入消息框中单击“确定”时,整个作业将终止。知道如何实现吗?

感谢您的帮助!

stage('Execute Shellscript')
{   
    steps 
    {
        script
        {
            try
            {
                def var1 = sshCommand remote: remote, command: "sh fastartstop.sh"
                sleep(time:30,unit:"SECONDS")   
            }
            catch(Exception e)
            {   
                currentBuild.result ='UNSTABLE'
                echo "The current status is ${currentBuild.result}"
                echo "Failed: ${e}"
                env.RELEASE_SCOPE = input message: 'Job failed. Please fix it manually and proceed further. Else click Abort to terminate the job!!!', ok: 'Proceed'  

                emailext (body: "", 
                    subject: "HOST ${params.FA_HOST} - FA Patching fails at ${env.STAGE_NAME} stage and refer Job ${env.BUILD_NUMBER} for more info. Please fix the issue manually and proceed further for next step!!",
                    to: "${params.EMAIL_LIST}")
            }        
        }
    } 
}

0 个答案:

没有答案