MethodsAndPractices / vsteam

PowerShell module for accessing Azure DevOps Services and Azure DevOps Server (formerly VSTS or TFS)
https://methodsandpractices.github.io/vsteam-docs/
MIT License
447 stars 155 forks source link

Getting details about other repos in a multi-repo pipeline? #391

Closed ebekker closed 3 years ago

ebekker commented 3 years ago

Is it possible to use VSTeam (or more generally, the ADO REST API) to obtain details about other repos that are defined and referenced in a multi-repo pipeline?

As per the docs, you can define additional repos in a YAML Pipeline which can then be pulled during a build.

At the end of the build, you can see details about these repos such as the branch and commit hash that was pulled under the Sources section, as can be seen in this pic:

image

Is it possible to retrieve these Sources via VSTeam?

SebastianSchuetze commented 3 years ago

I am not sure. With Vs team you can do everything that is provided with the Azure DevOps API. But I believe since it is defined in the YAML itself you will be at maxim able to get info from the meta data of the pipeline run or the pipeline itself. So if you check the API regarding the pipeline then maybe.

SebastianSchuetze commented 3 years ago

just checked. Maybe with this API endpoint:

https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/get?view=azure-devops-rest-6.0#repositoryresource

You can use Invoke-VSTeamRequest

https://methodsandpractices.github.io/vsteam-docs/docs/modules/vsteam/commands/Invoke-VSTeamRequest

ebekker commented 3 years ago

Thanks for the suggestion. I dug around in the APIs and played with some tests. Unfortunately, the API only returns the "self" repo, in which the pipeline definition is itself contained in. The strange thing is that there is also a list of "links" in the response, and one of them is a "web" link for the information which returns the rendered HTML as in the sample image I sent above. That rendered HTML contains all the GIT sources that I'm looking for -- it's just not found in the associate REST API call. Very weird.

Do you by any chance know where I should direct inquiries related to this to the team response for the Azure REST APIs? Is it a GitHub repo or a UserVoice forum that I can submit the inquiry to?

Thanks again!

ebekker commented 3 years ago

As short-term kludge, it looks like that HTML page does contain all the details of the run in a structured form as embedded meta data in JSON. So I was able to extract out these bits from an embedded script section, convert it from JSON and query on it. Thanks again for the tip!

SebastianSchuetze commented 3 years ago

On you organization menu you should be able to get the link where you can report bugs, make suggestions and also ask question that is answered directly by the Azure DevOps product team:

image

This is the feedback page: https://developercommunity.visualstudio.com/home?space=21&stateGroup=active&ftype=idea&sort=votes&page=1

SebastianSchuetze commented 3 years ago

gonna close this, as this can't be done with the module.