Sar
Sar

Reputation: 299

Azure Devops RestAPI to access Resources in YAML pipelines

In Azure DevOps Multi Stage YAML Pipeline, under resources section I had defined 2 repo resources Demo2 and Demo3. I want to access the changes happening between the builds for the repo Demo2 and Demo3. In pipeline summary page, there is an option view changes, which gives the commits from the repo and I am trying to get that details via RestAPI.

I tried to find details via Azure DevOps RestAPI page and az devops CLI but can't find anything helpful, so reaching out here for help.

Pipeline Summary shows the view changes

resources:
  repositories:
  - repository: Demo2
    type: git
    name: 'Test/Repo2'
  - repository: Demo3
    type: git
    name: 'Test/Repo3'

trigger:
- main

pool:
  vmImage: ubuntu-latest

steps:
- checkout: Demo2
- checkout: Demo3
- script: echo Hello, world!
  displayName: 'Run a one-line script'

Upvotes: 0

Views: 185

Answers (1)

Leo Liu
Leo Liu

Reputation: 76890

Azure Devops RestAPI to access Resources in YAML pipelines

I am afraid there is no such documented REST API to get the details via option view changes.

But we could try to use F12 to grab the URL:

https://dev.azure.com/{organization}/{project}/_traceability/runview/changes?currentRunId={Build Id}

Then we will get the feedback with HTML type, we could convert it the Json type, we could get some info about the commit:

enter image description here

If we need to check the context of the commit, we could use the REST API [Commits - Get] 2 to get the details.

Upvotes: 0

Related Questions