我拨打电话:
得到如下结果:
{
"builds": [{
"actions": [{
"parameters": [{
"name": "JT_BUILD_ID",
"value": "1274"
}]
}, {}, {}, {}, {}],
"number": 3,
"result": "SUCCESS"
}, {
"actions": [{
"parameters": [{
"name": "JT_BUILD_ID",
"value": "1273"
}]
}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}],
"number": 2,
"result": "SUCCESS"
}, {
"actions": [{
"parameters": [{
"name": "JT_BUILD_ID",
"value": "0"
}]
}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}],
"number": 1,
"result": "SUCCESS"
}]
}
我正在传递JT_BUILD_ID,所以我可以匹配MYJOB的这次运行。
当我找到匹配的JT_BUILD_ID时,我会看结果,当我看到SUCCESS时,我认为我已经完成了。但是这项工作仍然在进行,以发布构建行动。
我如何才能匹配构建实例(使用参数JT_BUILD_ID)并检测作业的最终状态?
答案 0 :(得分:4)
building
下还有另一个键builds
,如果构建后仍然有效,状态将保持为true
。当工作完成后,它会变为false
。
因此,您可以为building == false
添加额外检查,最终网址如下所示
如果最新版本正在进行(在构建后阶段),结果可能如下所示
{
"builds": [{
"actions": [{
"parameters": [{
"name": "JT_BUILD_ID",
"value": "1274"
}]
}, {}, {}, {}, {}],
"building" : true,
"number": 3,
"result": "SUCCESS"
}, {
"actions": [{
"parameters": [{
"name": "JT_BUILD_ID",
"value": "0"
}]
}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}],
"building" : false,
"number": 1,
"result": "SUCCESS"
}]
}