This is the first part of my blogpost about integration between issue tracking system, CI server and VCS. Part 2 is about project setup. Part 3 is about resolving an issue.
1. Place in the software development process
Issue tracking system, continues integration build server and version control system (VCS) is a central part of software production (whatever model of development waterfall, agile, anarchy we use).
2. Software components
- TeamCity as a continues integration server.
- Stash (with Git backend) as a version control system
- JIRA as a ticketing and project management tool
3. Integration between issue tracking and VCS
a. User story: As a developer I want to see changes in code related to an issue registered in a tracker
To enable integration between JIRA ans Stash both JIRA must be connected to Stash and Stash must be connected to JIRA. Login to JIRA as an administrator. Go to Administration -> Add-ons -> Application Links (on the right side of the page) Add the connection to the Stash application here.
Click on [Edit] and configure OAuth. Use Administrator account.
Same should be done in Stash. Go to Administration -> Add-ons -> Application Links (on the right side of the page) Add the connection to the JIRA application here. The configure OAuth using administrative account.
Every issue in JIRA has to special tabs in an Activity section named Commits and Source to show connected source control system. Commits from Stash will be shown in the Source tab.
But first a new branch related to the issue must be created. After clicking on the [Create Branch] link browser will be redirected to Stash application.
Then developers must add an issue key to every commit messages in this branch. An issue key is a shorten code of an issue two letters and a number like UN-1 on the picture above. Then commits from this branch will be connected with an issue in JIRA by this key in commit message. Otherwise it will not work because of Git branching model.
While integrating JIRA with Mercurial (on BitBucket.org for instance) it is not needed to put a key to every commit mesage, because of other branching model in Mercurial. Since all the changesets in Mercurial belong to a branch then we need just a branch name to be associated with an issue. But Stash does not work with Mercurial yet thus we will use Git.
Read more about JIRA integration in the documentation.
b. User story: As a developer I want to easy find an issue in a tracker that was the reason for a change in code
Developers want to know why specific code was written. In Stash it is possible to watch issues in commits history in a branch. Open a project in Stash, and goto Commits tab. The most right column will contain related issue(s) name if it was specified while commit.
And its is possible to watch issues in file commits history. Choose a file, open Source view and drop down History menu. Issues keys will be in the dropdown list.
4. Integration between VCS and CI server
a. User story: As CI server I want to start build process after check-in
This is a natural property of every build server. TeamCity supports Git and many others VCSs. And it supports different scenarios to trigger a build.
b. User story: As a developer I want to see a connection between build and a changeset
Every build have a number that can contain changeset ID.
Read TeamCity documentation about how to enable build of feature branches for a specific VCS. It is supported for both Mercurial and Git.
5. Integration between CI server and issue tracking system
a. User story: As a developer I want to see all builds related to an issue in a tracker
There is a TeamCity plugin for JIRA that links builds to issues in the tracker.