View Source

QuickBuild now integrate with [Trac|http://trac.edgewall.org] natively. The integration features:
* Hyperlink the Trac ticket id in commit messages to corresponding JIRA pages
* Generate an issues report from commit messages
* Progress/update the issues from commit messages
* Release a milestone of a project in Trac
* Create an issue to Trac based on a customized step condition

This page will describe how to integrate Trac in QuickBuild.

*On This Page*

{toc:class=pagetoc|style=disc|indent=20px|maxLevel=3}

{info}
Supported Trac version: 0.11 or higher.
{info}

h3. Basic Integration
To enable the integration:

# *Install and enable XML RPC plugin for Trac.* This plugin and its installation guide can be found at below link:
http://trac-hacks.org/wiki/XmlRpcPlugin
# *Configure Trac Server on configuration settings tab.*
!trac-settings.png!
Below lists the descriptions of these properties:
||Property||Description||
|Server URL|Defines the server url. you can test it by adding "/rpc", for example, if the server url is: http://localhost/trac/project, open below url in your browser: http://localhost/trac/project/rpc, and if the "Remote Procedure Call (RPC)" page can be displayed correctly, the url is correct. |
|User Name|The user should have TICKET_VIEW permission. If you want to update issues from QuickBuild, the user should also have TICKET_MODIFY permission.|
|Ticket Pattern|Defines the ticket pattern which will be used to extract the ticket id from commit messages. The ticket pattern here uses [Java regular expression|http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html] to match the ticket ids. By default, below pattern will match #123 or ticket:123.
{code}
(?<!\:)(?:#|ticket:)\d+
{code}
|

After doing these, the issues keys mentioned in commit messages will be hyperlinked:

!issues-on-overview.png!

and a ticket report will be displayed in Build tab:

!issues.png!

you can also find all related issues from a specified version and view the changes for an issue:
!issues-changes.png!

After configured the Trac server in the configuration settings, below steps are available to add in your build workflow:
* Update Issue Step
* Release Version Step
* Create Issue Step

!trac-steps.png!

h3. Advanced Integration
Besides the basic integration, QuickBuild also features:
* Update tickets mentioned in commit messages directly
* Cooperate with Trac to manage both Trac and QuickBuild version
* Release a Trac milestone and also update the milestone field of tickets mentioned in commit messages which can help you to generate the Release Notes easily.

h4. Update Tickets
To update tickets from the commit messages, *Update Trac Ticket* step should be added to your build workflow. And when QuickBuild find any [commit command|Commit Command] in the commit message, QuickBuild will execute it to update or progress the ticket.

*NOTE:*
* To update tickets, the user defined in Trac setting should has the TICKET_ADMIN permission.
* This step should be defined after your checkout step.
* QuickBuild will update all tickets which are requested from the commit comments from *previous successful* build.
* If a ticket updated manually after committed, this tickets will not be updated then.

h5. Customize Commit Command
The [commit command|Commit Command] can be customized in the step:
!customize-commands.png!

The _commit command_ property defines the commit command which you can change to meet your company requirements. And the _update attributes_ here are what you want to change in your Trac when executing the commit command. For example, when executing _accept_ commit command above, QuickBuild will update the ticket status and change it to accept, also will update the owner to the command committer which is same as the SCM committer.

Below section will discuss the attributes available.

h5. Command Attributes
The command attributes for Trac are defined by the Trac server. You may ask your Trac administrator for available attributes or reference [http://trac.edgewall.org/wiki/TracTickets]. By default Trac installation, the attributes include:
* *type* - The nature of the ticket (for example, defect or enhancement request)
* *reporter* - The author of the ticket.
* *summary* - A brief description summarizing the problem or issue.
* *description* - The body of the ticket.
* *component* - The project module or subsystem this ticket concerns.
* *version* - Version of the project that this ticket pertains to.
* *status* - What is the current status? One of new, assigned, closed, reopened or whatever you add/customize in the Trac.
* *resolution* - Reason for why a ticket was closed.
* *priority* - The importance of this issue, ranging from trivial to blocker.
* *milestone* - When this issue should be resolved at the latest.
* *owner* - Principal person responsible for handling the issue.
* *cc* - A comma-separated list of other users or E-Mail addresses to notify.
* *comment* - Add a comment to the ticket

These attributes can be used not only in the _Update Trac Ticket_ step, but also in the [commit commands|Commit Command].

h4. Release Milestone
To release milestone to Trac server, a *_Release Trac Milestone_* step should be added to your build workflow. The step will help you to release a milestone to your Trac server, the milestone version will use the build version and also this step will set milestone field of all tickets mentioned in the commit messages from previous successful build.