0
votes

In order to work around this issue 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). It only seems to return data for the self repo. For example, the response payload for one of my runs looks like:

    "resources": {
        "repositories": {
            "self": {
                "repository": null,
                "refName": "refs/heads/master",
                "version": "commit-hash"
            }
        }
    },

Despite the fact that there are several other repos checked out in the pipeline. Is this a bug or expected? Is there a workaround?

Thanks!

1
Hi, Just checking in to see whether this issue is still blocking you now? Any update for this issue? - Vito Liu
Hi. Yes! I was able to work with this. Thank you. - Alex Denton
Hi @AlexDenton, Glad to hear that your problem has been solved, would you please accept it as the answer? So it could help other community members who get the same issues and we could archive this thread. Thanks. Have a nice day. :) - Vito Liu

1 Answers

0
votes

We could get the REST API via F12 and this REST API is https://dev.azure.com/{Org name}/{Project name}/_build/results?buildId={Build ID}&__rt=fps&__ver=2

Power shell script:

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

Result:

enter image description here

Note: This yaml file save in the repo sample and the self repo is sample repo