GitLab Connector for Jira
GitLab Connector for Jira, allows the reception of GitLab push events using GitLab project web hooks.
This app allows integration of commits pushed to GitLab inside JIRA issues. Issue keys are extracted from commit messages; then, these messages are logged as JIRA comments, activities, work logs and/or workflow transitions linking back to the GitLab changesets.
Why use GitLab Connector in preference to the built-in GitLab - Jira Integration?
GitLab CE / EE includes the basic GitLab-JIRA integration. It covers some simple use cases, but that may be not enough in some scenarios. The GitLab Connector extends the basic integration by allowing you to:
Reference multiple issues in a single commit message.
Use commit messages to execute any workflow transition (i.e. not just closing issues).
Use commit messages to generate worklogs (i.e. time tracking).
Restrict visibility of comments, etc. generated by the add-on to a project role.
Select between generating JIRA comments or JIRA activities.
Link GitLab and JIRA users instead of generating JIRA comments using a generic JIRA API user as the basic integration does.
Support multiple JIRA issue key formats.
This is why we developed GitLab Connector
So lets get started
Install the app following the standard instructions available in the Atlassian Marketplace.
Log into your Jira instance as an admin.
Click the admin dropdown and choose Add-ons.The Manage add-ons screen loads.
Click Find new apps or Find new add-ons from the left-hand side of the page.
Locate GitLab Connector for Jira via search.
Results include app versions compatible with your Jira instance.
Click Install to download and install your app.
If your app cannot be installed directly into your application, you may be prompted to download.
You're all set!
Click Close in the Installed and ready to go dialog
Step 1 :- Configure the add-on according with your preferences. Optionally you can set:
A shared secret between GitLab & JIRA.
A list of e-mail addresses mapping to JIRA usernames to be used when the e-mail address in a commit message does not match any existing JIRA user.
Several fallback JIRA usernames to be used when a JIRA user is not available. If a JIRA user is not available while processing commits, comments / activities, work logs and / or workflow transitions linked to those unmatched commits won't be generated / executed.
For each GitLab project you want to integrate with JIRA, set up a web hook in order to submit all push events to the listener add-on. If defined in the previous step, remember to include the value of the secret in the query string of the URL.
3. When integrating multiple GitLab instances with JIRA you must use the
instance field in the query string (simply use a different instance name in each GitLab instance; this allows the add-on to differentiate commits notified by each instance):
Step 2 :- Start pushing commits with messages including references to JIRA issues and work log information.
# Appends a JIRA comment / activity to issue ALLGEN-10. # Changes issue ALLGEN-10 status executing a workflow transition using action named 'close issue'. # Sets issue ALLGEN-10 resolution to 'fixed'. $ git commit -m "ALLGEN-10 Fixed memory leak #action close issue, fixed" # Appends a JIRA comment / activity to issues ALLGEN-10, ALLGEN-15 and GTTSLT-6. # Changes issues ALLGEN-10, ALLGEN-15 and GTTSLT-6 status executing a workflow transition using action named 'reopen issue'. $ git commit -m "ALLGEN-42 ALLGEN-15 GTTSLT-6 Fixed some memory leaks #action reopen issue" # Appends a JIRA comment / activity to issue ALLGEN-14. # Appends a JIRA work log to issue ALLGEN-14. $ git commit -m "ALLGEN-14 #time 1w 2d 4h 30m" # Appends a JIRA comment / activity to issues ALLGEN-22 and ALLGEN-10. # Appends a JIRA work log to issues ALLGEN-22 and ALLGEN-10, each one including the description 'Completed ahead of schedule'. $ git commit -m "Added all diagrams #time 1w 2d 4h 30m Completed ahead of schedule #refs ALLGEN-22 ALLGEN-10" # Appends a JIRA comment / activity to issues ALLGEN-12 and GTTSLT-2. # Appends a JIRA work log to issues ALLGEN-12 and GTTSLT-2. $ git commit -m "Bumped new version #refs ALLGEN-12 GTTSLT-2 #time 1h 15m"
Step 3 :- Sample Commit Messages
Commit format is
<ISSUE-1> [<ISSUE-2> <ISSUE-3> ...] <description of the commit> [#refs <ISSUE-4> [<ISSUE-5> <ISSUE-6> ...]] [#time <duration> [<annotation to be included in the JIRA work log>]] [#action <workflow action to be executed>[, <resolution>]].
The configured JIRA issue key format (
jira.projectkey.patternproperty) is the one supported. This format usually is two or more uppercase letters, followed by a hyphen and the issue number, for example ALLGEN-123.
Users can reference multiple issues in the same commit message, separated by whitespace at the begging of the message or using the
#refsdirective anywhere inside the commit message. There is also an option available to enable searching of issue keys in the whole commit message.
You may enforce inclusion of JIRA issues in all commit messages defining a simple git hook in the local copies of the repositories.
The e-mail address included in the commit data must match some e-mail address in the JIRA user base.Otherwise, if defined in the add-on settings, some explicit e-mail address - JIRA user mapping rules will be used. Finally, fallback JIRA users will be used if everything fails and they are defined in the add-on settings. Along with a match of the e-mail address:
The JIRA user must have permission to comment issues in the particular project. Unlike comments, generation of JIRA activities does not require any special permission.
When using the
#timedirective, the user must have permission to log work on the issue.
When using the
#actiondirective, (1) the user must have permission to execute workflow transitions to the issue; and (2) the workflow action to be executed should be valid according with the current status of the issue.
When referencing more than one issue and using the
#timedirective, a entry is added to the work log of all the referenced issues.
When referencing more than one issue and using the
#actiondirective, a workflow transition is executed in all the referenced issues.
Step 4 :- How to Enable Debug Level?
Log in as a user with the 'JIRA System Administrators' global permission.
Choose 'System'. Then select
Jira v7 and earlier: Choose 'System'. Then select 'Troubleshooting and Support > Logging & Profiling' to open the Logging page.
Jira v8 and newer: 'Logging & Profiling' under 'SYSTEM SUPPORT' to open the Logging page.
Scroll to the 'Default Loggers' section and click 'Configure logging level for another package'.
Package name is
Step 5 :- How to monitor app performance?
The app uses a simple underlying table (
AO_9B0D9B_PROCESSED_COMMIT) to keep track of the commits already processed. Because of limitations of the Active Objects framework, the add-on cannot create indexes and unique constraints that span more than one column on installation time.
Please, ask you DBA to manually create an index and unique constraint spanning the
HASH columns. This is not required, but it should boost performance on busy environments.