[英]Azure Devops stage wise build information using rest api not available
I am using rest api to gather some information from azure devops.我正在使用 rest api 从 azure devops 收集一些信息。 I want to get full build results including every stage.我想获得完整的构建结果,包括每个阶段。 But in the documentation it is not available.但在文档中它不可用。 The simple build api call only gives me limited data.简单的构建 api 调用只给我有限的数据。 Is there any way to collect the stage wise information like whether the stage was successful or the start and end time for each stage.有什么方法可以收集阶段信息,例如阶段是否成功或每个阶段的开始和结束时间。
Will be grateful for the help.将不胜感激。
You should first call this url:您应该首先调用此 url:
https://dev.azure.com/<YourOrg>/<Your-project>/_apis/build/builds/<buildid>?api-version=5.1
in links you will find timeline:在链接中,您将找到时间线:
"_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"
}
},
and there you will find what you are looking for:在那里你会找到你要找的东西:
{
"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"
},
You can also refer to the below api, this rest api is grabbed from the browser's Network.也可以参考下面的api,这个rest api是从浏览器的网络中抓取的。
Get https://dev.azure.com/{org}/{pro}/_build/results?buildId={id}&__rt=fps&__ver=2
Stage results are represented by different numbers ie 0->completed,5->canceled etc.阶段结果由不同的数字表示,即 0->完成,5->取消等。
The disadvantage of this api is that the returned content cannot be read intuitively.这个api的缺点是返回的内容不能直观的阅读。 In contrast, the workaround provided by Krzysztof Madej is more convenient and intuitive相比之下,Krzysztof Madej 提供的解决方法更方便直观
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.