- Smart Commits
- Configure a GitLab application for DVCS
- Configure Jira for DVCS
- Refresh data imported to Jira
- Migrate to the GitLab for Jira Cloud app
Jira DVCS connector
Use the Jira DVCS (distributed version control system) connector if you self-host your Jira instance and want to sync information between GitLab and Jira. If you’re using the Jira DVCS connector with Jira Cloud, migrate to the GitLab for Jira Cloud app.
When you configure the Jira DVCS connector, make sure your GitLab and Jira instances are accessible.
- Self-managed GitLab: Your GitLab instance must be accessible by Jira.
- Jira Server: Your network must allow access to your instance.
Smart Commits
When connecting GitLab and Jira with the Jira DVCS connector, you can process your Jira issues with special commands called Smart Commits. With Smart Commits, you can:
- Comment on issues.
- Record time-tracking information against issues.
- Transition issues to any status defined in the Jira project’s workflow.
Commands must be in the first line of the commit message. For more information about how Smart Commits work and what commands are available for use, see the Atlassian documentation.
For Smart Commits to work, the GitLab user must have a corresponding Jira user with the same email address or username.
Smart Commit syntax
Smart Commits must follow this pattern:
<ISSUE_KEY> <ignored text> #<command> <optional command parameters>
Some examples:
- Add a comment to a Jira issue:
KEY-123 fixes a bug #comment Bug is fixed.
- Record time tracking:
KEY-123 #time 2w 4d 10h 52m Tracking work time.
- Close an issue:
KEY-123 #close Closing issue
A Smart Commit message must not span more than one line (no carriage returns), but you can still perform multiple actions in a single commit. For example:
-
Add time tracking, add a comment, and transition to Closed:
KEY-123 #time 2d 5h #comment Task completed ahead of schedule #close
-
Add a comment, transition to In-progress, and add time tracking:
KEY-123 #comment started working on the issue #in-progress #time 12d 5h
Configure a GitLab application for DVCS
For projects in a single group, you should create a group application.
For projects across multiple groups, you should create a new user account in GitLab for Jira integration work only. A separate account ensures regular account maintenance does not affect your integration.
If a separate user account or group application is not possible, you can set up this integration as an instance-wide application or with a user-owned application.
- Go to the appropriate Applications section.
- In the Name text box, enter a descriptive name for the integration (for example,
Jira
). - In the Redirect URI text box, enter the generated Redirect URL from linking GitLab accounts.
- In Scopes, select
api
and clear any other checkboxes. The DVCS connector requires a write-enabledapi
scope to automatically create and manage required webhooks. - Select Submit.
- Copy the Application ID and Secret values. You need these values to configure Jira.
Configure Jira for DVCS
To import all GitLab commits and branches into Jira for the groups you specify, configure Jira for DVCS. This import takes a few minutes and, after it completes, refreshes every 60 minutes:
- Complete the GitLab configuration.
- Go to your DVCS account:
- For Jira Server, select Settings (gear) > Applications > DVCS accounts.
- To create a new integration, for Host, select GitLab or GitLab Self-Managed.
- For Team or User Account, enter the relative path of a top-level GitLab group that the GitLab user can access.
-
In the Host URL text box, enter the appropriate URL. Replace
<gitlab.example.com>
with your GitLab instance domain. Usehttps://<gitlab.example.com>
. - For Client ID, use the Application ID value.
- For Client Secret, use the Secret value.
- Ensure that all other checkboxes are selected.
- To create the DVCS account, select Add and then Continue.
- Jira redirects to GitLab where you have to confirm the authorization. GitLab then redirects back to Jira where the synced projects should display in the new account.
To connect additional GitLab projects from other GitLab top-level groups or personal namespaces, repeat the previous steps with additional Jira DVCS accounts.
For more information about how to use the integration, see Jira development panel.
Refresh data imported to Jira
Jira imports the commits and branches every 60 minutes for your projects. You can refresh the data manually from the Jira interface:
- Sign in to your Jira instance as the user you configured the integration with.
- Go to Settings (gear) > Applications.
- Select DVCS accounts.
- In the table, for the repository you want to refresh, in the Last Activity column, select the icon.
Migrate to the GitLab for Jira Cloud app
If you’re using the Jira DVCS connector with Jira Cloud, migrate to the GitLab for Jira Cloud app. For more information, see Install the GitLab for Jira Cloud app.
Feature comparison of DVCS and GitLab for Jira Cloud app
Feature | DVCS | GitLab for Jira Cloud app |
---|---|---|
Smart Commits | Yes | Yes |
Sync MRs | Yes | Yes |
Sync branches | Yes | Yes |
Sync commits | Yes | Yes |
Sync builds | No | Yes |
Sync deployments | No | Yes |
Sync feature flags | No | Yes |
Sync interval | 60 Minutes | Real time |
Create branches | No | Yes (Only GitLab SaaS) |
Historic data sync | Yes | No |
Risks of migrating
The GitLab for Jira Cloud app has a limited ability to sync historic data. Only branches, commits, builds, deployments, and feature flags created after installing the GitLab for Jira Cloud app are synced with Jira.