Reputation: 1979
I would like to add a step in my Azure Devops build pipeline to do the following
Does anyone know if there is an existing marketplace step to do this? If not, has anyone written a script to do this in the past that they could share?
Upvotes: 0
Views: 1976
Reputation: 1979
I ended up creating a new marketplace extension to solve this problem.
The extension allows you to update a field on the workitem with the associated build number.
Logic is as follows
The ReleaseNotesHub step is very configurable and great for leveraging the AzureDevops\TFS query designer for querying workitems associated with a particular build.
The marketplace extension can be found here
Upvotes: 1
Reputation: 28196
Identify any workitems that are closed\completed and associated with changesets included in the current build
To get workitems associated with current build, you can use Builds - Get Build Work Items Refs:
GET https://{instance}/{collection}/{project}/_apis/build/builds/{buildId}/workitems?api-version=5.0
To get workitems that are closed/completed, you can use Wiql - Query By Wiql:
POST https://{instance}/{collection}/{project}/{team}/_apis/wit/wiql?api-version=5.0
To update field of a workitem, you can use Workitem-update:
PATCH https://{instance}/CollectionName/_apis/wit/workitems/{id}?api-version=5.0
You can use Powershell script to execute these apis, $(Build.BuildId)
variable represents the buildID and $(Build.BuildNumber)
variable represents the buildNumber, you can check predefined variables.
Upvotes: 1
Reputation: 1161
The WorkItem Updater addon in the Marketplace will help you achieve some of what you are asking.
You can look at a list of work items that are associated with your build or release, or the results of a query you have already saved in Azure DevOps.
You then have the option to modify a number of built-in fields or define the custom ones you want to update.
Here is a reference for the settings screen you will get in your pipeline.
Upvotes: -1