我正在使用rest api从azure devop收集一些信息。我想获得包括每个阶段在内的完整构建结果。但是在文档中不可用。简单的build api调用仅给我有限的数据。有什么方法可以收集阶段信息,例如阶段是否成功或每个阶段的开始和结束时间。
将感谢您的帮助。
答案 0 :(得分:2)
您应该首先调用此网址:
https://dev.azure.com/<YourOrg>/<Your-project>/_apis/build/builds/<buildid>?api-version=5.1
在链接中,您会找到时间表:
"_links": {
"self": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/Builds/460"
},
"web": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_build/results?buildId=460"
},
"sourceVersionDisplayUri": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/460/sources"
},
"timeline": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/460/Timeline"
},
"badge": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/status/30"
}
},
在那里您会找到想要的东西:
{
"previousAttempts": [],
"id": "67c760f8-35f0-533f-1d24-8e8c3788c96d",
"parentId": null,
"type": "Stage",
"name": "A",
"startTime": "2020-04-24T08:42:37.2133333Z",
"finishTime": "2020-04-24T08:42:46.9933333Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 12,
"lastModified": "0001-01-01T00:00:00",
"workerName": null,
"order": 1,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": null,
"task": null,
"attempt": 1,
"identifier": "A"
},
答案 1 :(得分:0)