0
votes

I have a release definition in VSTS configured to trigger automatically based on when a particular build completes (and publishes an artifact). If I look at the build summary UI page in the browser, there's a section labeled "Deployments" that shows me the release definitions that were triggered due to that build completing. How can I use the VSTS REST API to query for the releases triggered due to a completed build (i.e. the information shown on that web page)?

I tried looking at the results of a REST query to get build details, e.g. https://{account}.visualstudio.com/DefaultCollection/{project-guid}/_apis/build/Builds/7420 but the JSON that comes back doesn't appear to mention the word "release" or "deployment" or "environment" anywhere in it.

1

1 Answers

0
votes

From what I can tell there is no way from the build query result to find the triggered release, but you can instead query for releases that were triggered by that build.

E.g. if the build that completed was number 123 then you could find all releases triggered by that build: https://{account}.vsrm.visualstudio.com/{project}/_apis/release/releases?sourceId={projectID}:{buildDefinitionId}&artifactVersionId=123&api-version=4.1-preview