Integrating TeamCity and Visual Studio Online Work Items
Continuous Integration only makes sense if there’s an easy way to verify the quality of our codebase and when we can easily correlate builds with our issue tracker and the source code itself. Out of he box, TeamCity provides integration with YouTrack, JIRA and Bugzilla. We can also install plugins to integrate with other issue trackers like GitHub and FogBugz. Today, we’re happy to announce another issue tracker integration: the Visual Studio Online Work Items plugin.
We’ve already blogged about how we can link Visual Studio Online source control with TeamCity and run our builds.When using Visual Studio Online (VSO) as an issue tracking system as well, we can use the Work Items plugin to provide a direct link between the build and version control history in TeamCity and the Work Items that were associated with them.
How does it work?
After installing and configuring the Visual Studio Online Work Item plugin, TeamCity will parse version control check-in messages and transforms the Work Item ID into a link that brings us to the full work item. A direct link will be available on the Changes tab of our build results. The Issues tab will show us a list of all Work Items that are associated with the build. And in the build configuration home page, we can also review Work Items mapped to comments from the Issue Log tab.
The plugin does not look at the Work Item Association, but instead uses the check-in message to provide these links. This has a big advantage: it works with both Team Foundation Version Control (TFVC)-based projects as well as the increasingly popular Git-based projects. This does mean we have to keep two things in mind:
- When checking-in changes, always mention the related Work Item ID in the check-in comments.
- On the Issue Log tab of a build, we can tick the Show only resolved issues option to only display issues that were fixed in the build. This does mean we have to resolve Work Items when they are fixed.
How to configure it?
To enable integration, we need to first install the Visual Studio Work Items plugin. Next, we have to create a connection to our Visual Studio Online project from the Administration | Issue Tracker page. After selecting the Visual Studio Online connection type, we have to provide a display name, our Visual Studio Account name, and a username and password to connect to it. Do make sure to enable alternate credentials in Visual Studio Online!
We also have to provide the collection, the project name and the issue pattern to detect. The default is
#(\d+), which will recognize Work Item IDs that look like #10, #99 and so on. We can customize this so we can detect other patterns. The Test Connection button lets us verify all connection details are correct.
Once saved, TeamCity starts to match each Work Item ID it recognizes in the project’s check-in history.