Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the associated changes, check-in comments and linked work items for a particular build/release in VSTS

I am using SendGrid email extension to trigger a custom email notification after the CI/CD process is complete in VSTS. This email task has HTML content in it which includes some content fetched using standard build/release variables (https://learn.microsoft.com/en-us/vsts/build-release/concepts/definitions/build/variables?tabs=batch).

How do I include associated code changes, check-in comments and linked work items for a particular release in the custom email? Are there any variables I can use? Any work around?

like image 593
vignesh srinivasan Avatar asked Feb 28 '18 13:02

vignesh srinivasan


People also ask

How do you retrieve all work items associated with a release pipeline using Azure DevOps API?

Click the Repositories and the Branches Menu in the Azure DevOps Portal . Locate in the branch list the one you are going to use to build from, typically that should be your master branch, and click the options icon. Select Branch policies. Check the option ”Check for linked work items”.

How do I find a particular changeset in TFS?

To find a changeset from the command prompt, enter tf changeset . For more information, see Changeset command.

How do you check changes in Azure DevOps?

Choose the files you want to check inIn Solution Explorer, right-click the solution, one or more code projects, or one or more files, and select Check In. In Source Control Explorer, select one or more items with pending changes, or one or more folders that contain items with pending changes.

How do you link work items in Azure DevOps?

Open a work item and choose the Links tab. From the links control tab you can link to new or existing work items, open the linked object, edit the link type, delete a link, or open the list of links in a query or Excel or Project. The work item form opens in the web portal for Visual Studio 2017 and later versions.


1 Answers

There aren’t the built-in variables that can get code changes, check-in comments and linked work items.

You can get them through REST API during build or release:

  1. Get build changes and work items through Get Build Changes REST API (Build id variable: Build.BuildId during build or Release.Artifacts.{Artifact alias}.BuildId during release) Note: using Build.SourceVersion to get latest version)
  2. Git: Get commit message through Get a batch of commits by a list of commit IDs REST API
  3. TFVC: Get check-in comment through Get list of changesets by a list of IDS REST API
  4. To get changed items, you can use get commit with changed items or Get list of changes in a changeset REST API.

No API to get detail code changes, but you may refer to this related issue: Lines of Code modified in each Commit in TFS rest api. How do i get?

like image 151
starian chen-MSFT Avatar answered Oct 21 '22 16:10

starian chen-MSFT