This page last changed on Sep 29, 2008 by williams.

This addition to the sourcecontrol provider allows easy linking with an issue tracking system like Jira, Gemini, Bugzilla, ...
The issueUrlBuilder will try to convert the comment (or parts from it) into an url pointing to the issue for this build.
These are the items that will have the comment transformed into an url linking to the issue :

  • Rss publisher
  • Modification history page
  • Project Build  Report

 Configuration :

This must be placed inside the sourcecontrol block. 

<issueUrlBuilder type="defaultIssueTracker">
   <url>http://jira.public.thoughtworks.org/browse/CCNET-{0}</url>
</issueUrlBuilder>

There are 3 types :

  • defaultIssueTracker
  • regexIssueTracker
  • multiIssueTracker

Types

defaultIssueTracker

For the defaultIssueTracker there is 1 element needed : url

It contains the url of the involved project, with the issue number as a parameter :{0}

Whenever a checkin is done, the following logic is applied :

  • split the comment into a string array; separator is space
  • from the first part, take all the numeric parts, starting from the end of this part
  • paste this number into the parameter 

ex.: with the mentioned configuration the following comments will be converted into  http://jira.public.thoughtworks.org/browse/CCNET-1223

  • CCNET-1223: CCnet should foresee a way to transform the comments into hyperlinks for integration with issue tracking systems
  • CCNET-1223 CCnet should foresee a way to transform the comments into hyperlinks for integration with issue tracking systems
  • CCNET-1223
  • 1223 

Example :

<issueUrlBuilder type="defaultIssueTracker">
   <url>http://jira.public.thoughtworks.org/browse/CCNET-{0}</url>
</issueUrlBuilder>

regexIssueTracker

For the regexIssueTracker there are 2 elements needed : find  and replace
This will use regular expressions to convert the comment into an url.
find  is the string to be sought, and will be replaced by the string in replace

Example :

<issueUrlBuilder type="regexIssueTracker">
   <find>^.*(CCNET-\d*).*$</find>
   <replace>http://jira.public.thoughtworks.org/browse/$1</replace>
</issueUrlBuilder>

For the ones not familiar with regular expressions :

find statement :

Assert position at the beginning of the string «^»
Match any single character that is not a line break character «.»*
   Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «»*
Match the regular expression below and capture its match into backreference number 1 «(CCNET-\d)»*
   Match the characters "CCNET-" literally «CCNET-»
   Match a single digit 0..9 «\d»*
      Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «»*
Match any single character that is not a line break character «.»*
   Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «»*
Assert position at the end of the string (or before the line break at the end of the string, if any) «$»

replace statement:

replace with  http://jira.public.thoughtworks.org/browse/backreference1; «$1»

multiIssueTracker

This issue tracker allows a combination of the other issuetrackers.
It has 1 element : issueTrackers
This is an array of other issuetrackers.

Example :

<issueUrlBuilder type="multiIssueTracker">
   <issueTrackers>
     <defaultIssueTracker>
          <url>http://jira.public.thoughtworks.org/browse/CCNET-{0}</url>
     </defaultIssueTracker>
     <regexIssueTracker>
        <find>^.*(CCNET-\d*).*$</find>
        <replace>http://jira.public.thoughtworks.org/browse/$1</replace>
     </regexIssueTracker>
</issueUrlBuilder>

This will first apply the default issueTracker on the comment, and afterwards the regexIssueTracker, overwriting a previous result.



Document generated by Confluence on Mar 14, 2009 02:55