未通过 Azure DevOps API 获取完整管道 运行 信息
Not getting full pipeline run information through the Azure DevOps API
为了解决这个问题Creating a dashboard for the last branch deployed through pipelines I thought I would try hitting the Azure DevOps API. It works fine for the most part however I've observed that the GET Run API does not return all the repository information for mult-repo pipelines (https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/get?view=azure-devops-rest-6.0)。 self
回购似乎只有 return 数据。例如,我的一次运行的响应负载如下所示:
"resources": {
"repositories": {
"self": {
"repository": null,
"refName": "refs/heads/master",
"version": "commit-hash"
}
}
},
尽管有几个其他的存储库正在检查中。这是错误还是预期的?有解决方法吗?
谢谢!
我们可以通过 F12 获得 REST API 而这个 REST API 是 https://dev.azure.com/{Org name}/{Project name}/_build/results?buildId={Build ID}&__rt=fps&__ver=2
电源shell脚本:
cls
$connectionToken="{PAT}"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($connectionToken)"))
$URL = "https://dev.azure.com/{Org name}/{Project name}/_build/results?buildId={Build ID}&__rt=fps&__ver=2"
$Result = Invoke-RestMethod -Uri $URL -Headers @{authorization = "Basic $base64AuthInfo"} -Method Get
Write-Host "This build sources are"$Result.fps.dataProviders.data."ms.vss-build-web.run-details-data-provider".repositoryResources.alias
结果:
注意:这个 yaml 文件保存在 repo sample
中,self
repo 是 sample
repo
为了解决这个问题Creating a dashboard for the last branch deployed through pipelines I thought I would try hitting the Azure DevOps API. It works fine for the most part however I've observed that the GET Run API does not return all the repository information for mult-repo pipelines (https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/get?view=azure-devops-rest-6.0)。 self
回购似乎只有 return 数据。例如,我的一次运行的响应负载如下所示:
"resources": {
"repositories": {
"self": {
"repository": null,
"refName": "refs/heads/master",
"version": "commit-hash"
}
}
},
尽管有几个其他的存储库正在检查中。这是错误还是预期的?有解决方法吗?
谢谢!
我们可以通过 F12 获得 REST API 而这个 REST API 是 https://dev.azure.com/{Org name}/{Project name}/_build/results?buildId={Build ID}&__rt=fps&__ver=2
电源shell脚本:
cls
$connectionToken="{PAT}"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($connectionToken)"))
$URL = "https://dev.azure.com/{Org name}/{Project name}/_build/results?buildId={Build ID}&__rt=fps&__ver=2"
$Result = Invoke-RestMethod -Uri $URL -Headers @{authorization = "Basic $base64AuthInfo"} -Method Get
Write-Host "This build sources are"$Result.fps.dataProviders.data."ms.vss-build-web.run-details-data-provider".repositoryResources.alias
结果:
注意:这个 yaml 文件保存在 repo sample
中,self
repo 是 sample
repo