你絕對可以使用Pipeline REST API Plugin,對我來說,Jenkins 2.13開箱即可使用。
通過解析生成的JSON,您可以獲得類似於您期望的階段狀態。對於api調用,我個人使用http_request插件。
從文檔GET /工作/:任務名稱/:運行ID/wfapi /描述回報:
{
"_links": {
"self": {
"href": "/jenkins/job/Test%20Workflow/16/wfapi/describe"
},
"pendingInputActions": {
"href": "/jenkins/job/Test%20Workflow/16/wfapi/pendingInputActions"
}
},
"id": "2014-10-16_13-07-52",
"name": "#16",
"status": "PAUSED_PENDING_INPUT",
"startTimeMillis": 1413461275770,
"endTimeMillis": 1413461285999,
"durationMillis": 10229,
"stages": [
{
"_links": {
"self": {
"href": "/jenkins/job/Test%20Workflow/16/execution/node/5/wfapi/describe"
}
},
"id": "5",
"name": "Build",
"status": "SUCCESS",
"startTimeMillis": 1413461275770,
"durationMillis": 5228
},
{
"_links": {
"self": {
"href": "/jenkins/job/Test%20Workflow/16/execution/node/8/wfapi/describe"
}
},
"id": "8",
"name": "Test",
"status": "SUCCESS",
"startTimeMillis": 1413461280998,
"durationMillis": 4994
},
{
"_links": {
"self": {
"href": "/jenkins/job/Test%20Workflow/16/execution/node/10/wfapi/describe"
}
},
"id": "10",
"name": "Deploy",
"status": "PAUSED_PENDING_INPUT",
"startTimeMillis": 1413461285992,
"durationMillis": 7
}
]
}
你有一些Groovy的代碼,獲取階段及其結果的列表?以某種方式使用REST API似乎是一種矯枉過正。 – sorin