Integrate JIRA in QuickBuild

You are viewing an old version (v. 61) of this page.
The latest version is v. 77, last edited on Aug 28, 2010 (view differences | )
<< View previous version | view page history | view next version >>

Since QuickBuild 3, a two-way solution is provided to integrate with Atlassian JIRA. The integration features:

  • Hyperlink the JIRA keys in commit messages to corresponding JIRA pages
  • Generate an issues report from commit messages
  • Progress/update the issues from commit messages
  • Release a version of a project in JIRA and update the fixed versions field of issues with status fixed or closed
  • Create an issue to JIRA based on a customized step condition
  • View SCM changes for each issue
  • View related builds for each issue
  • View related builds for each project

This page will describe how to integrate JIRA in QuickBuild.

On This Page

Supported JIRA version should be JIRA 3.13.3 or higher.

Basic Integration

To enable the integration:
1. Enable 'Access remote API calls' in JIRA Administration

2. Configure JIRA server in your configuration setting tab

You can associate a JIRA project with this configuration. This project is used when you want to update issues or release version to JIRA. See details below.

After doing these, the issues keys mentioned in commit messages will be hyperlinked:
Unable to render embedded object: File (issues-overview.png) not found.

and an issues report tab will be displayed in Build tab:
Unable to render embedded object: File (issues-tab.png) not found.

you can also find all related issues from a specified version and view their changes:
Unable to render embedded object: File (issues-history.png) not found.

After configured the JIRA server in the configuration settings, below steps are available to add in your build workflow:

  • Update Issue Step
  • Release Version Step
  • Create Issue Step

Advanced Integration

Besides the basic integration, QuickBuild also features:

  • Update issues mentioned in commit messages directly
  • Cooperate with JIRA to manage both JIRA and QuickBuild version
  • Release a JIRA version and also update the Fix Version/s field of issues mentioned in commit messages which can help you to generate the Release Notes easily.

Update Issues

To update issues from the commit messages, Update JIRA Issue step should be added to your build workflow. And when QuickBuild find any commit commands in the commit message, QuickBuild will execute these commands to update or progress the issues listed in the commands.

NOTE:

  • To update issues, QuickBuild need map SCM committer to JIRA user as we want to make sure the updates in JIRA are made by the same person who submits the commit commands.
  • This step should be defined after your checkout step.
  • QuickBuild will update all issues which are requested from the commit comments from previous successful build.
  • If issue updated manually after committed, this issue will not be updated then.
  • Only issues which belong to the associated project be updated.
Associate SCM user with JIRA user

If you are using LDAP or Single Sign On (SSO) to manage your users for SCM, QuickBuild and JIRA, you need do nothing. Or if you are using the same user name and password for SCM, QuickBuild and JIRA, you also need do nothing. If they are different, you have to:

  • If the SCM user is different with QuickBuild user, you need associate them in your configuration Repository settings.
  • If the JIRA user is different with QuickBuild user, you need associate them in Administration -> User Management tab (if you are administrator) or go to My tab (if you are normal user), enable and input your JIRA account like below:
Customize Commit Command

The commit command has two types:

  • Progress Command which is used to progress an issue in the JIRA workflow
  • Update Command which is used to update an issue only and will not lead to a workflow transition and by default QuickBuild will use update as the command name. You can rename to any word you want in the step editor.

The progress commands can be customized in the Update Jira Issue step based on your JIRA workflow definition.

Command Attributes

A commit command has below attributes, each attribute relates to the field of an issue:

Attribute Description
summary The summary of an issue
description The description of an issue
type The issue type
priority The issue priority
reporter The reporter of an issue
assignee The assignee of an issue
environment The environment field of an issue
affectsVersions The affects versions field of an issue
fixVersions The fixed versions field of an issue
comment Add a comment to an issue
time

To use time attribute, time tracking must be enabled in your JIRA server. Please check with your JIRA administrator, if you cannot record time tracking information against issues.

Records the time tracking information of an issue. The syntax for time is:

<n>w <n>d <n>h <n>m <worklog comment>

Here, <n> is user specified time period. For example: 1w 2d 3h 20m Total cost period - this will record 1 week 2 days 3 hours and 20 minutes against the issue and add the comment 'Total cost period' in the Work Log tab of the issue.

JIRA custom fields are also supported, for custom fields, below format can be used:

customfield_10000
or just
10000

here, 10000 is the field id of a custom field. Please reference http://confluence.atlassian.com/display/JIRA/Custom+fields for details about custom field or consult your JIRA administrator for the custom field id.

Below we will give some example commit messages to illustrate the commit commands:

  • In below commit message, QuickBuild will resolve the issues TST-1 and TST-2 and add comment The issue has been fixed to both issues.
    1. Modified Foo.java to fix TST-1, TST-2 --comment The issue has been fixed
    2. Some dummy comments ...
    
  • In below commit message, QuickBuild will add 2d 3h to the worklog and add comment Some comment to issue TST-1. The value of time 2d 3h should be used the format defined in JIRA time tracking.
    Update TST-1 --time 2d 3h --comment Some comment
    
  • In below commit message, the value of custom field 10000 will be updated to for custom field1 and custom field 10001
    Update TST-1 --customfield_10000 for custom field1 --10001 for custom field2
    

    will be updated to for custom field2.

You can define common attributes in the Update Jira Issue step so that when updating issues, the attributes can be applied to all of the issues. When an attribute is specified both in commit command and Extra Attributes, the value in commit command will be used.

Release QuickBuild Version to JIRA

To release version to JIRA, Release JIRA Version step should be added to your build workflow. And this step will release the build version to the associated project in JIRA. If this version does not exist, QuickBuild will create it automatically. Also, this step will find all closed or resolved issues of the associated project which were mentioned in commit messages and then update the Fix Version/s field of them.

  • The user defined in JIRA Setting must have global or project administrator rights in order to release version.
  • Only the issues with status closed or resolved in the associated project will be updated.

The version can be managed either from QuickBuild or from JIRA:

Manage from QuickBuild

By default, the version is managed by QuickBuild, that means you need not define any version for the associated project in JIRA and QuickBuild will automatically create and release the version of this build.

Manage from JIRA

Sometimes, you want to manage the versions in JIRA side by yourself and let QuickBuild retrieve the version from JIRA. In this scenario, you just need change your Next Build Version (in configuration settings -> General Setting section) to use next unreleased version from JIRA, and then you will find the next build version will be the first unreleased version you defined in JIRA when go to configuration dashboard.

Create Issue from QuickBuild

You may create an issue from QuickBuild by adding a Create JIRA Issue step. A common case is that when build failed, create an issue so that we can track the build from JIRA.

Trouble Shooting

  • Q: I can't add comment to a closed issue, why?
    A: You need modify the file $JIRA_HOME/atlassian-jira/WEB-INF/classes/jira-workflow.xml, find 'Closed' step and change the value of 'jira.issue.editable' to true.
  • Q: The commit command failed with error: Workflow step 'Start Progress' is not valid for issue: ABC-123, but I can progress this issue directly from Jira GUI.
    A: The user defined in JIRA server should have the permissions to do all of the workflow actions which defined in workflow command transition. If you encountered the problems above, please login to Jira with that user and check the 'Available Workflow Actions' section.
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.