本文介绍了即使前一个失败,我如何确保Jenkins流水线阶段始终执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个Jenkinsfile示例,即使上一步失败,该示例也始终执行.

I am looking for a Jenkinsfile example of having a step that is always executed, even if a previous step failed.

我想确保在出现故障的情况下能够归档一些构建结果,并且我需要能够在最后始终执行一个始终运行的步骤.

I want to assure that I archive some builds results in case of failure and I need to be able to have an always-running step at the end.

我该如何实现?

推荐答案

   try {
         sh "false"
    } finally {

        stage 'finalize'
        echo "I will always run!"
    }

这篇关于即使前一个失败,我如何确保Jenkins流水线阶段始终执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 22:56