[英]Azure DevOps Server object Api get builds by change id
使用 Azure 管道 object API 可以獲得構建。
BuildHttpClient.GetBuildsAsync(params)
現在我可以獲取構建的更改,因為我需要通過特定的更改 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!
有沒有辦法在 API 上構建,它在一個查詢中具有特定的更改 ID?
您可以從BuildHttpClient.GetBuildsAsync
獲取sourceVersion
和id
,並直接過濾sourceVersion
。 sourceVersion
是 changesetId/CommitId。 例如:
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.