0
我在詹金斯管道中运行一系列阶段。 每个阶段代表一个测试。 即使阶段(测试)失败,我想继续以下阶段(测试),但我不知道如何。即使在失败阶段后仍继续使用管道
我知道的唯一解决方案是用try/catch子句包含阶段步骤,但这样我就不知道测试失败或成功了。
它们不能并行运行,它们必须按顺序运行。
有没有更好的解决方案?
相关问题:Jenkins continue pipeline on failed stage
我在詹金斯管道中运行一系列阶段。 每个阶段代表一个测试。 即使阶段(测试)失败,我想继续以下阶段(测试),但我不知道如何。即使在失败阶段后仍继续使用管道
我知道的唯一解决方案是用try/catch子句包含阶段步骤,但这样我就不知道测试失败或成功了。
它们不能并行运行,它们必须按顺序运行。
有没有更好的解决方案?
相关问题:Jenkins continue pipeline on failed stage
这是不是最佳的,因为詹金斯不知道哪个阶段都失败了,但我们手动收集数据:
def success = 0
def failed = []
for (int i = 0; i < tests.size(); i++) {
def test = tests[i]
stage(test) {
try {
sh "...."
success++
} catch (e) {
failed << test
}
}
}
stage('Report') {
def failCount = tests.size()-success
if (failCount == 0)
echo "Executed ${success} tests successfully."
else
error """Executed ${success} tests successfully and ${failCount} failed:
${failed.join(', ')}"""
}