I am looking for a way to produce all TFS Work Items from a Jenkins promote job.
We have an on prem deployment of TFS with service hooks in place to build the corresponding applications on check-in. The changeset Id is included with the notification, but I need the TFS work item for that Changeset.
More importantly - we will have several builds run; each with a singular changeset before we actuall run the promotion job.
What I would like to do is find a way to produce the list of TFS work items between releases. Looking a plug-in or tool that will help produce this.
Update
You should first get the built changeset info in Jenkins side.
There seems to be a build.changeSets variable which could retrieve all the changeset.
Then you could directly use rest api in TFS to query work items info from changeset ID. Detail steps kindly take a look at here: How to retrieve work items associated to a build in jenkins with pipeline?
According to your description, seems you just want to get all work items between releases (for example: the current release and a previous release).
Retrieve work items by calling
https://{account}.vsrm.visualstudio.com/[teamproject]/_apis/Release/releases/{current release id}/workitems?api-version=4.1-preview.1&baseReleaseId={release id}
It just return the id, url of work items, and then you need to get details of work item through Get a list of work items REST API.
Related
Imagine this:
You have an Azure DevOps 2019 server and a XAML Build definition.
You queue a few check-ins to the build definition. The first one is in progress of being checked in, the rest are waiting in queue.
How does one using the REST API get the shelvesets of the queued builds?
It's easy to get the shelveset associated with the InProgress build, because there's a BuildID present. I use it to get more details on the build using the API, e.g.: "Builds/33217/Details".
From there on, I can get to the shelveset.
If a build is queued (or NotStarted), then the build details API returns:
{
"value": [],
"count": 0
}
... and therefore I cannot get the shelveset.
I was under the impression that a upgrade to DevOps 2019 amends the API, so that one can easily get the queued shelveset from XAML build definitions as well. However, I'm not sure what I'm missing here. Should I be using another API?
Short answer ref Microsoft backlogged/doesn't exist/no easy way explained in option 1, but I used option 2, and option 3, I hope this helps you, I struggled a good bit!
Underlying issue is that you're querying from 1) Bottom to Top in DevOps build Hierarchy/Object Model, and you need to 2) Associate the shelveSets versioned changeSet & then to the build.
2. TLDR, I simply followed a practice of prefixing/Tags from my shelveSets allowing me to custom query the build as listed in option 3. This allowed me to simplify it a good bit in the REST API Query tagFilters={tagFilters} for e.g. ShelveSetBuildTag-....
// now modify you REST API filter `ShelveSetBuildTag-....`
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds?definitions={definitions}&queues={queues}&buildNumber={buildNumber}
&tagFilters={tagFilters}&buildIds={buildIds}&repositoryId={repositoryId}&repositoryType={repositoryType}&api-version=6.0
Option 1: No example so, MS build docs was clear as mud for me, and was not helpful but its listed as possible, I gave up and took a different route, below..
Option 2:
since shelveSets are unversioned Azure DevOps uses versioned changeSets per their ER/DB Design , I had to get the associated shelveSets via ChangeSets/or WorkItems in a build.
First, a nice article I found to help me understand the relationship and difference between two key items, changeSet vs shelveSet Azure DevOps in relation to a build. The changeSet will allow you to find associated shelvesets to build, query it and get DimChangeset, I suspect you have to do this in a couple of steps.
picture below is associated with the following dimension tables:
DimBuild
DimChangeset
DimPerson
DimTeamProject
IMHO versioning allows you get your changeset associated with a build, and then you can get the shelveset that went into that changeset
Step 1: get changetSets for a ShelveSet
GET https://dev.azure.com/fabrikam/_apis/tfvc/shelvesets/changes?shelvesetId=My first shelveset;d6245f20-2af8-44f4-9451-8107cb2767db&api-version=6.0
Step 2: get
GET the changes in a build
https://{instance}/DefaultCollection/{project}/_apis/build/builds/{buildId}/changes?api-version={version}
Step 3: I manually join the Response in my middle ware
option 3:
Follow a practice of tagging your shelveSets
Then, you query, using tags filer: tagFilters={tagFilters} in your build query
Use the tags from your shelvesets and filter from your builds list tagFilters={tagFilters} , of course this assume you setup tags
// ``tagFilters={tagFilters}``for your shelveset assuming you set those up
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds?definitions={definitions}&queues={queues}&buildNumber={buildNumber}&minTime={minTime}&maxTime={maxTime}&requestedFor={requestedFor}&reasonFilter={reasonFilter}&statusFilter={statusFilter}&resultFilter={resultFilter}&tagFilters={tagFilters}&properties={properties}&$top={$top}&continuationToken={continuationToken}&maxBuildsPerDefinition={maxBuildsPerDefinition}&deletedFilter={deletedFilter}&queryOrder={queryOrder}&branchName={branchName}&buildIds={buildIds}&repositoryId={repositoryId}&repositoryType={repositoryType}&api-version=6.0
I need to know which projects are part of a changeset for a specifc build using the VSTS API 2018. The REST api doesn´t seem to support getting a changeset based on a buildId. https://learn.microsoft.com/en-us/rest/api/vsts/tfvc/changesets/get
Is it possible to get a changeset based on a build ID?
Yes. You're looking at the wrong area of the documentation.
Ref: https://learn.microsoft.com/en-us/rest/api/vsts/build/builds/get%20build%20changes
GET
https://{accountName}.visualstudio.com/{project}/_apis/build/builds/{buildId}/changes?api-version=4.1
That gets you the changes associated with a build. If you want to get more details on the changesets from there, you can retrieve the specific changesets using the API you've already discovered.
I've received a request to create a custom report email for our executives. When we do a major release they want a list of Features of that release. What i need to do is read the related Tasks to the release then traverse up parent nodes until i get to the features that are marked with a tag "Executive". My Issue is that I can't find any document on how get the "Work items linked to associated changes".
I've been able to just through to get the specific build
GET http://XXX.MYTFSSERVER.COM/tfs/Collection/Project/e5e632e2-ae70-41c9-9d72-6686d2375f14/_apis/build/Builds/69330
But I don't see any link to get the workitems associated to the build.
Releases already do this out-of-the-box. On the Work Items tab of a release, you can have it generate an email that contains all of the work items associated with that release relative to an earlier release.
There isn't any build-in way to achieve this such as through TFS work item query. You need to build a extension to get all work items of specific release and filter them later.
The steps to achieve that with extension:
Get specify release to get build id
Get work items of that build per build id
Get related work items
Filter the work items which you actually need
A detail simple code of extension to get work items of specific release that you can refer to this link: TFS 2017 Release Management: How to display parent PBI for Tasks under Release
Is it possible to filter changesets in TFS 2012 to exclude the ones from a single user?
The commit history of the solution I currently work on contains quite a lot of noise due to an automated process making a commit each time a build is queued.
I'd like to filter it out to make the commit history more readable.
An alternative, try to install Team Foundation Sidekicks, and check History Sidekick. You can export the records to a .csv file and then filter the user in it:
There is no single query can achieve what you need. You may have to use TFS API.
If you want to get the changesets in a solution via TFS API. The folder history will be the simplest approach. Details please refer this: TFS client C# API - get all changesets of an Item You can exclude those changesets from the special user using Changeset.Committer Property which gets the user who committed the changeset.
Can we get release information from checkedIN history.
we are using TFS 2012.
we have frequent release mostly on each week or on each 14 days.
Can we generate release document from TFS ?
(something like, based on TFS checked IN comments OR some how )
One way to do this would be to use Work Items (e.g. User Stories and Bugs) to generate your release notes.
But this requires your team to have the discipline to enter the information into TFS that allows it to associate work items with a release. For example:
Require developers to associate change sets with work items
Use fields such as "Iteration" or "Integrated in build" in work items to identify the release to which a work item belongs.
You could then create a suitable Team Query and export it to Excel to generate release notes.
I tend to use the Tf history command line tool to get information of changesets between two particular dates (or changesets). You can pass the /format:detailed parameter to get details such as changes involeed.
For example, the following will list all the changes between the 01/02/2014 & 24/04/2014 and write it to the history file.
tf history /noprompt * /recursive /v:D01/02/2014~D24/04/2014
/format:detailed > C:\history.txt
I like the TFS Changelog tool. Ready to use and easy to integrate.
TFS ChangeLog allows Team Foundation Server (TFS) users to extract information related to Changesets and associated WorkItems into XML format that is transformed into HTML.
All of these are nice tools, but there are a few things still missing I think.
These are technical notes (more like build / history notes) but actual release notes contain more customer friendly items
Not all of the information in TFS are wanted on the customer release notes (internally found bugs vs reported bugs)
As of now I use the TFS Community build manager to generate the technical build notes. It uses OpenXML and works fine for you build notes. It's even easy to create a custom word document for it.
For release notes we actually use the TFS User stories / tasks to be able to query on it. And for now, we create the document manually with the query results. We're looking into creating some tools that might do the following:
Run queries corresponding to the document paragrahs
We have a TFS template field indicating that the work item must be on the customer release notes (but we should change this to use 'special' iterations or so to eliminate the need of a custom field.
Automatically fill in the OpenXml placeholders in the document the same way as the build notes generator does.
Like the TFS Community Build Manager you could create a TFS Community Release Notes Manager that asks for query names and runs these queries to get to the required data.
The main question here is whether there are already tools that do this?
I know this is an old question, but perhaps you can use this task extension Generate Release Notes Build Task (for local TFS or as an extension to VisualStudio.com).
This extension is a build task you can use in build steps. This task generates a markdown release notes file based on a template passed into the tool. Here is an example of release notes output:
Release notes for build SampleSolution.Master
Build Number: 20160229.3 Build started: 29/02/16 15:47:58 Source
Branch: refs/heads/master
Associated work items
Task 60 [Assigned by: Bill ] Design WP8 client Associated change
sets/commits
ID bf9be94e61f71f87cb068353f58e860b982a2b4b Added a template ID
8c3f8f9817606e48f37f8e6d25b5a212230d7a86 Start of the project