[英]Azure DevOps Server object Api get builds by change id
With Azure Pipeline object API it is possible to get builds.使用 Azure 管道 object API 可以获得构建。
BuildHttpClient.GetBuildsAsync(params)
Now I can get the changes for a build, because I need to filter the builds by a specific change id (commit hash)现在我可以获取构建的更改,因为我需要通过特定的更改 id(提交哈希)过滤构建
BuildHttpClient.GetBuildChangesAsync(params, buildId)
// Here I can loop over the changes and search for a specific change id (commit hash)
// But this scales very bad, getting the changes is really slow. Doing this on tousand of builds can take minutes!
Is there a way to get builds over the API which has a specific change id in one query?有没有办法在 API 上构建,它在一个查询中具有特定的更改 ID?
You could get sourceVersion
and id
from BuildHttpClient.GetBuildsAsync
, and filter sourceVersion
directly.您可以从
BuildHttpClient.GetBuildsAsync
获取sourceVersion
和id
,并直接过滤sourceVersion
。 sourceVersion
is the changesetId/CommitId. sourceVersion
是 changesetId/CommitId。 For example:例如:
string _personalAccessToken = "xxxxxxxxx";
VssBasicCredential credentials = new VssBasicCredential("", _personalAccessToken);
var connection = new VssConnection(new Uri(@"https://dev.azure.com/xxxx"), credentials);
var buildServer = connection.GetClient<BuildHttpClient>();
var builds = buildServer.GetBuildsAsync($"teamprojectname").Result;
foreach (var build in builds)
{
if (build.SourceVersion == "commitID")
{
Console.WriteLine(build.Id);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.