Over the course of different implementations, to improve the integration of Jenkins with Jira, the decision was made to synchronize build data from Jenkins into Jira. As previous implementations proved that the Jenkins API was not able to handle the load that larger Jira and Jenkins instances can produce. Now, selected data elements of the Jobs and there builds are synchronized from Jenkins to Jira.
This synchronization can be trigger in two manners:
- First, there is the Jira Build Notification Listener that will trigger synchronization of that specific Job after a build is completed.
- Second, through the use of the administration UI.
Site synchronization is triggered when the site is added for the first time, when an unknown job triggers that a build is completed, or through manual action in the UI and will synchronize:
- Whether the remote site has the Jenkins Jira Plugin installed
- If the Jenkins plugin is installed, then the Jira site will be registered with the Jenkins site to use the Jira Build Notification Listener.
- Whether the remote site uses Crumbs for CSRF protection
- The basic details of Jobs listed at the root level, this includes name and url information.
- If a job is no longer available on the remote site, then the job is marked as deleted, but is not removed from Jira. Once it becomes available again, then the deletion marker will be removed.
- Once the job list is synchronized, then the synchronization for each individual job is triggered
Job synchronization operation is either triggered by a Site Synchronization operation or by the Jira Build Notification Listener and will synchronize:
- Detailed Job information including, display name, description
- Identify builds that need to be synchronized, and trigger the synchronization of them
- When builds are removed from the remote site, then that build is marked as deleted but and not removed from Jira.
- And as of version 2.1.0, identifies whether the job itself has jobs that need to be synchronized, this process is the same as for the job list of a site at root level.
The build synchronization is a part of the Job Synchronization operation and will only synchronize data elements that are needed for the plugin to function.
Data elements synchronized and stored include:
- build number
- display name
- (trigger) cause
- duration of the build
- timestamp of execution
- build result
- the node the build was executed on
- basic test result stats including total tests executed, number of tests that failed and that where skipped.
Linking Builds to Issues
The following elements are inspected to extract Jira issue keys:
- Job display name
- Job description
- Job url
- Build display name
- Build description
- Build trigger cause
- Change-set commit messages
Any potential issue key located will be verified to exist, and a link between the build is issue is only created if the issue exists in Jira.
It is important to note that the issue keys in the commit message must follow the rules set by Atlassian on the format of Project Keys and therefor Issue Keys. Details on the format rules can be found in there documentation Changing the project key format.