如何通过DevOps REST API获取特定提交的构建列表 [英] How to get build list for particular Commit through DevOps REST API

查看:50
本文介绍了如何通过DevOps REST API获取特定提交的构建列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过Azure DevOps REST API检索与特定Commit相关联的生成列表(请参见TFS UI图片).我可以使用蛮力来做到这一点:

  1. 通过

    解决方案

    API call. Cannot find here a filter for commit:

GET https://dev.azure.com/{organization}/{project}/_apis/build/builds

  1. Then filter-out only builds with specified "commitId": "eed1b008520c2b32669bef9a0a08be8a50b6e8a4"

But this is extremely inefficient solution. Can you help me if there is a more efficient way? I tried to load details for Commit with links, but there is no link to build or builds.

解决方案

There is Statuses API for Commit. It seems that when starting and ending build, the appropriate status is posted.

So when I call GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits/{commitId}/statuses?api-version=5.1

I get all last builds associated with the Commit and their statuses.

Thanks to Hugh Lin for showing me direction..

这篇关于如何通过DevOps REST API获取特定提交的构建列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆