Jenkins Pipeline DSL:我可以有条件地重试整个阶段吗?
有时,我们的Jenkins阶段失败了以下错误:
Emulator did not finish booting within 600 seconds, aborting
这通常是因为VM进入某种类型的低内存状态,并且随后在该VM上启动模拟器的任何尝试都会失败。因此,在这种情况下,我想自动重新执行整个阶段(希望应该自动为新的VM分配)。我该如何实现?
有选项{retry(3)}
,
stage("android-ui-tests") {
options {
retry(3)
}
steps {
// run stage..
}
}
但是Afaik,这不是条件。像以下类似的API是理想的:
options {
retry(3) {
if(exception.contains("Emulator did not finish booting")) {
// `true` to retry
return true
}
return false
}
}
是否存在类似的API?还是可以检查失败并触发重试的帖子条件?
Sometimes our Jenkins stage fails with the following error:
Emulator did not finish booting within 600 seconds, aborting
This usually happens because the VM has entered some type of low memory state and any subsequent attempts to boot the emulator on that VM will failure. So in this scenario, I'd like to automatically re-execute the entire stage as a whole (should hopefully automatically be assigned a new VM). How can I achieve this?
There's options { retry(3) }
stage("android-ui-tests") {
options {
retry(3)
}
steps {
// run stage..
}
}
But AFAIK, this is not conditional. An API like the following would be ideal:
options {
retry(3) {
if(exception.contains("Emulator did not finish booting")) {
// `true` to retry
return true
}
return false
}
}
Does anything like this exist? Or maybe a post condition that could inspect the failure and trigger a retry?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论