在脚本管道中跳过的例外
我有一个带有这样的代码的脚本詹金斯管道。
func_stage_1() {
try {
stage1
} catch {
}
}
func_stage_1()
最初,当我没有内部功能的阶段时,如果阶段失败并打印了异常,则管道曾经失败。将其放入功能之后,即使一个阶段失败,它仍会继续整个管道。如何解决这个问题?
I have a scripted jenkins pipeline with the code like this.
func_stage_1() {
try {
stage1
} catch {
}
}
func_stage_1()
Initially when I did not have the stage inside function, pipeline used to fail if a stage failed and exceptions were printed. After putting it inside function, it continues the whole pipeline even though one stage fails. How to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加异常逻辑背后的主要功能是继续该过程,即使阶段失败了。
如果要使剩余过程停止,如果发生异常,则必须以下面的方式进行。
Main functionality behind adding exception logic is to continue the process even though the stage is failed.
If you want to make the remaining process stop, if exception occurred then you have to do it in below way.