You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

What is an Issue Connector?

Issue Connectors link fixes from commit/checkin messages to your issue tracking system. They work by detecting an issue id in your checkin messages and creating a hyperlink within the Continua CI environment to your issue tracking system.

Linking Commit/Checkin Issue Fixes

When Continua gets the latest changesets from your source repository, it automatically retrieves all commit/checkin messages associated with that changeset. If your source repository is linked to an issue connector then it will also try to parse the commit/checkin messages for issue ids. It will then take those  issue id's from the commit message and generate a hyperlink to that issue in your issue tracking system. The list of hyperlinks will be displayed in the "Issues" tab when viewing a build. Issue Connectors do not interact with your issue tracking system, they just generate hyperlinks to it! It won't open or close issues or require any kind of login to your system. 

Why use an Issue Connector?

Lets say you have set up a Repository Trigger so every time a check in is made, the configuration is built. Every time a configuration is built, the build always knows about the latest changeset, or in this case, the changeset that triggered the build.  If your company's policy is to have meaningful commit messages that reference your issue tracking system, then an Issue Connector will link Continua to it. With an Issue Connector, you can give it a regular expression to retrieve the issue id and other information from the commit/checkin message and use them to create hyperlinks to a specific issue.

Example:

Set up an Issue Connector like so:

Issue Sever URL:  http://www.issues.com/issue/{id}

Commit Message Regex: #(?<id>\d+)

Assume a user commits something to the repository with the message "Fixed annoying deadlock bug, solves issue #29981". The Commit Message Regex in this example extracts any number that is preceded by the # (Hash) symbol. The Issue Connector would extract the value "29981" out of the commit message and use the Issue Server URL to generate the link "http://www.issues.com/issue/29981".

Creating and Editing Issue Connector

Issue Connectors can be created and edited in the Administration area, under the Continuous Integration section.

 

Issue Connector Rules and Restrictions

For an Issue Connector to work, the Commit Message Regex must have an id group.

The regular expression used to extract id's takes advantage of named groups. Whenever you use a named group in the regular expression it must have a corresponding tag in the Issue Server URL. 

The example above has the id in both fields... the highltighed text shows the matching pair:

Issue Sever URL:  http://www.issues.com/issue/{id}

Commit Message Regex: #(?<id>\d+)

 

You can have multiple groups in an Issue Sever URL/Commit Message Regex

If you have an issue tracking system that also takes in a project, it's possible to modify the regular expression to handle it.

Suppose your commit message is: "Fixed bug for issue  #myawesomeproject-29981"

You could setup your Issue Connector like so:

Issue Sever URL:  http://www.issues.com/{project}/issue/{id}

Commit Message Regex: #(?<project>\w+)-(?<id>\d+)

This would generate the URL: http://www.issues.com/myawesomeproject/issue/29981


You can have multiple issue id's in a commit message

Taking our first example's Issue Connector settings, a commit message "Fixed annoying deadlock bug, solves issues #29981, #44412 and #9881" would generate three links:

http://www.issues.com/issue/29981
http://www.issues.com/issue/44412
http://www.issues.com/issue/9881


Creating an Issue Connector

Click the icon that represents a hammer and spanner in the upper right hand corner of the page. It will bring up the Administration Menu, click "Builds".

 

On the left hand side of the page, under the section "Builds", click "Issue Connectors". It will display a list of Issue Connectors and a button which you can use to create a new one.

Click the "New Issue Connector" button to launch the new issue connector dialog.

The Name of the Issue Connector is used to reference the Issue Connector throughout the Continua UI. The Issue System is a drop down list of the more popular issue tracking systems. The option you select from the Issue System drop down has no effect on the Issue Connector, it simply pre-populates the "Commit Message Regex" and "Issue Server URL" fields. You could just as easily select "Custom" from the drop down and fill out the other fields with your settings. The two important fields are "Commit Message Regex" and "Issue Server URL".


Commit Message Regex

The Commit Message Regex is a regular expression that tells the issue connector to extract certain data out of commit messages and store them in a named group. To properly construct a regular expression to your needs, determine what your repository commit message will contain then write the regex to extract the issue id out of it. When extracting the id, make sure you use regular expression named groups to name that issue id match to the group "id". You may also add other named groups to your regex which can then be used when generating the URL.

 

Issue Server URL

The Issue Server URL is a template URL for generating links to your issue system. A simple way to construct the URL is to take a link to a certain issue in your issue system then substitute the issue id field in it with {id}. When the issue id's are parsed out of the commit message using the commit message regex, they'll then be substituted into the template URL where the {id} field was placed.


After inputting the regex and URL you can verify your settings by providing a typical commit message you would use when checking in a fix for a bug. After clicking "Verify", and if it was successful, you should see a hyperlink that will take you to that issue in your issue tracker.



Link an Issue Connector to a Repository

Once an Issue Connector has been created and for it to be any use, it must be linked to a repository. To do this, select edit on the Repository you wish to add an issue connector to and select the Issue Connector you created from the drop down. Save the Repository and from then on the Issue Connector will monitor repository checks and try parse issue id's out of them.


  • No labels