Swarm's JIRA integration allows code reviews and committed changes to be associated with JIRA issues, making it easy to reference associated issues, and see the state of a code review or committed change within JIRA.
To associate a code review with a JIRA issue, include a JIRA issue identifier in the review's description, for example SW-1234
. Swarm links to the JIRA issue and creates a link within the JIRA issue back to the code review in Swarm. Multiple JIRA issues can be included in the changelist description.
As a code review progresses, Swarm updates each associated JIRA issue with the review's current status.
Swarm fetches JIRA project identifiers using a worker, once per the worker process' lifetime. See Worker configuration. New JIRA projects will not auto-link to JIRA until the project identifiers have been updated. By default, project identifiers are updated once every ten minutes.
Swarm can also be configured to add a link to a Perforce job within a JIRA issue. Perforce job links are created when a new JIRA or job is created or updated. This gives you direct access to the Perforce job from a link in the Issue Links section of the JIRA issue.
By default, JIRA module and Perforce job links are disabled.
See Enabling the JIRA module and Enabling Perforce job links in JIRA issues for details on configuring these features.
For a summary of JIRA integration and Perforce job link workflow, see JIRA integration and Perforce job link workflow.
job_field
must be set, see Enabling Perforce job links in JIRA issues. When enabled, the JIRA module links JIRA issues referenced in change descriptions, job descriptions, comments, and reviews to your local JIRA service. By default, the JIRA module is not enabled.
To enable the JIRA module, add the following configuration block to your SWARM_ROOT/data/config.php
file:
<?php
// this block should be a peer of 'p4'
'jira' => array(
'host' => '', // URL for your installed JIRA web interface
'user' => '', // the username required for JIRA API access
'password' => '', // the password required for JIRA API access
'job_field' => '', // optional, if P4DTG is replicating JIRA issue IDs
// to a job field, list that field here
),
If your JIRA web interface uses HTTPS, you may need to configure HTTP client options so that Swarm can connect successfully.
When a Perforce job is created, a link to that job is added to the associated JIRA issue. When P4DTG replication detects a change to an issue, such as description, status, etc. a job link is added to the associated JIRA issue if it does not already exist.
If Swarm fails to add a Perforce job link to a JIRA issue because that JIRA issue does not exist, the failure is logged by Swarm. Swarm will not try to add the job link to that JIRA issue again.
If a Perforce job is updated and the DTG_DTISSUE
field value is changed, a job link will be added to the new JIRA issue. The Perforce job link will not be removed from the original JIRA issue.
Prerequisites for Perforce job links in JIRA issues:
job_field
must be setTo enable Perforce job links in JIRA issues, add the following configuration block to your SWARM_ROOT/data/config.php
file:
<?php
// this block should be a peer of 'p4'
'jira' => array(
'host' => '', // URL for your installed JIRA web interface
'user' => '', // the username required for JIRA API access
'password' => '', // the password required for JIRA API access
'job_field' => '', // optional, if P4DTG is replicating JIRA issue IDs
// to a job field, list that field here
'link_to_jobs' => false, // set to true to enable Perforce job links in JIRA, P4DTG and job_field required
'delay_job_links' => 60, // delay in seconds, defaults to 60 seconds
),
link_to_jobs
:
false
: disable Perforce job links in JIRA. The default setting is false
. true
: enable Perforce job links in JIRA. delay_job_links
: delay set in seconds. Sets the delay between a new JIRA or job being created or updated, and Swarm adding the job link to the JIRA issue. This configurable is used to avoid a race condition between JIRA and the Helix Server. By default delay_job_links
is set to 60 seconds, if a race condition is experienced increase the delay time.
This section describes the workflow for JIRA integration and job links in JIRA issues when you request a new Swarm review from P4V.
The process for adding a Perforce job and creating a review differs for the other clients but the Swarm worker and Perforce Defect Tracking Gateway (P4DTG) workflow is the same.
job_field
exists in the Perforce job, Swarm adds a link to the new Perforce job in the Issue Links section of the JIRA issue. To check that these steps have been completed and to view the links: