2020-10-24 23:57:45 +05:30
---
stage: Create
group: Ecosystem
2021-02-22 17:27:13 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2020-10-24 23:57:45 +05:30
---
2018-12-05 23:21:45 +05:30
# GitLab Jira integration
2017-08-17 22:00:37 +05:30
2021-03-11 19:13:27 +05:30
You can use Jira to track work implemented in GitLab. The Jira integration with GitLab makes the
process of working across these systems more efficient.
2020-10-24 23:57:45 +05:30
2021-03-11 19:13:27 +05:30
The GitLab Jira integration, available in every GitLab project by default, allows you to connect
to any Jira instance, whether on Atlassian cloud or self-managed.
2017-08-17 22:00:37 +05:30
2021-03-11 19:13:27 +05:30
You can also install the [Jira Development Panel integration ](../../../integration/jira_development_panel.md ).
For more information about the differences between the two integrations, see
[Jira integrations ](jira_integrations.md ).
2017-08-17 22:00:37 +05:30
2021-03-11 19:13:27 +05:30
After you set up this integration, you can cross-reference activity in the GitLab project with any
of your projects in Jira. This includes the ability to close or transition Jira issues when work is
completed in GitLab and:
2019-09-04 21:01:54 +05:30
2021-03-11 19:13:27 +05:30
- Mention a Jira issue ID in a commit message or MR (merge request) and:
2020-10-24 23:57:45 +05:30
- GitLab links to the Jira issue.
- The Jira issue adds a comment with details and a link back to the activity in GitLab.
2021-03-11 19:13:27 +05:30
- Mention that a commit or MR resolves or closes a specific Jira issue and when it's merged to the default branch:
2021-02-22 17:27:13 +05:30
- The GitLab MR displays a note that it closed the Jira issue. Prior to the merge, MRs indicate which issue they close.
2020-10-24 23:57:45 +05:30
- The Jira issue shows the activity and is closed or otherwise transitioned as specified in your GitLab settings.
2021-03-11 19:13:27 +05:30
- Run a pipeline on an MR linked to a Jira issue:
- The Jira issue shows the current pipeline status (in the sidebar as "builds").
- Deploy to an environment from an MR linked to a Jira issue:
- The Jira issue shows the status of the deployment (in the sidebar as "deployments").
- Create or modify a feature flag that mentions a Jira issue in its description:
- The Jira issue shows the details of the feature-flag (in the sidebar as "feature flags").
- View a list of Jira issues directly in GitLab. ** (PREMIUM)**
- Create a Jira issue from a vulnerability. ** (ULTIMATE)**
2018-12-05 23:21:45 +05:30
2021-03-11 19:13:27 +05:30
Additional features provided by the Jira Development Panel integration include:
2018-12-05 23:21:45 +05:30
2020-10-24 23:57:45 +05:30
- In a Jira issue, display relevant GitLab information in the [development panel ](https://support.atlassian.com/jira-software-cloud/docs/view-development-information-for-an-issue/ ), including related branches, commits, and merge requests.
- Use Jira [Smart Commits ](https://confluence.atlassian.com/fisheye/using-smart-commits-960155400.html ) in GitLab to add Jira comments, log time spent on the issue, or apply any issue transition.
2021-03-11 19:13:27 +05:30
- Showing pipeline, deployment, and feature flags in Jira issues.
2017-08-17 22:00:37 +05:30
## Configuration
2020-10-24 23:57:45 +05:30
< i class = "fa fa-youtube-play youtube" aria-hidden = "true" > < / i >
For an overview, see [Agile Management - GitLab-Jira Basic Integration ](https://www.youtube.com/watch?v=fWvwkx5_00E&feature=youtu.be ).
2021-03-11 19:13:27 +05:30
Each GitLab project can be configured to connect to an entire Jira instance. That means one GitLab
project can interact with _all_ Jira projects in that instance, once configured. For:
- The [view Jira issues ](#view-jira-issues ) feature, you must associate a GitLab project with a
specific Jira project.
- Other features, you do not have to explicitly associate a GitLab project with any single Jira
project.
If you have one Jira instance, you can pre-fill the settings. For more information, see the
documentation for:
- [Project integration management ](../../admin_area/settings/project_integration_management.md ).
- [Services Templates ](services_templates.md ).
To enable the Jira service in GitLab, you must:
2017-09-10 17:25:29 +05:30
2021-03-11 19:13:27 +05:30
1. Configure the project in Jira.
1. Enter the correct values in GitLab.
2017-09-10 17:25:29 +05:30
2021-03-11 19:13:27 +05:30
### Configure Jira
2017-08-17 22:00:37 +05:30
2021-03-11 19:13:27 +05:30
The process for configuring Jira depends on whether you host Jira on your own server or on
[Atlassian cloud ](https://www.atlassian.com/cloud ).
2017-08-17 22:00:37 +05:30
2019-09-30 21:07:59 +05:30
#### Jira Server
2019-03-02 22:35:43 +05:30
2021-03-11 19:13:27 +05:30
Jira Server supports basic authentication. When connecting, a **username and password** are
required. Connecting to Jira Server via CAS is not possible. For more information, see
[set up a user in Jira Server ](jira_server_configuration.md ).
2017-08-17 22:00:37 +05:30
2021-03-11 19:13:27 +05:30
#### Jira on Atlassian cloud
2019-03-02 22:35:43 +05:30
2021-03-11 19:13:27 +05:30
Jira on Atlassian cloud supports authentication through an API token. When connecting to Jira on
Atlassian cloud, an **email and API token** are required. For more information, see
[set up a user in Jira on Atlassian cloud ](jira_cloud_configuration.md ).
2017-08-17 22:00:37 +05:30
2021-03-11 19:13:27 +05:30
### Configure GitLab
2017-08-17 22:00:37 +05:30
2018-11-20 20:47:30 +05:30
> **Notes:**
2019-07-07 11:18:12 +05:30
>
2020-07-28 23:09:34 +05:30
> - The supported Jira versions are `v6.x`, `v7.x`, and `v8.x`.
2021-02-22 17:27:13 +05:30
> - In order to support Oracle's Access Manager, GitLab sends additional cookies
2018-11-20 20:47:30 +05:30
> to enable Basic Auth. The cookie being added to each request is `OBBasicAuth` with
> a value of `fromDialog`.
2017-08-17 22:00:37 +05:30
2021-03-11 19:13:27 +05:30
To enable the Jira integration in a project:
1. Go to the project's [Integrations page ](overview.md#accessing-integrations ) and select the
**Jira** service.
1. Select **Enable integration** .
1. Select **Trigger** actions.
This determines whether a mention of a Jira issue in GitLab commits, merge requests, or both,
should link the Jira issue back to that source commit/MR and transition the Jira issue, if
indicated.
1. To include a comment on the Jira issue when the above reference is made in GitLab, select
**Enable comments** .
1. Select the **Comment detail** : **Standard** or **All details** .
2020-07-28 23:09:34 +05:30
2021-03-11 19:13:27 +05:30
1. Enter the further details on the page as described in the following table.
2020-07-28 23:09:34 +05:30
2021-03-11 19:13:27 +05:30
| Field | Description |
| ----- | ----------- |
| `Web URL` | The base URL to the Jira instance web interface which is being linked to this GitLab project. For example, `https://jira.example.com` . |
| `Jira API URL` | The base URL to the Jira instance API. Web URL value is used if not set. For example, `https://jira-api.example.com` . Leave this field blank (or use the same value of `Web URL` ) if using **Jira on Atlassian cloud** . |
| `Username or Email` | Created in [configure Jira ](#configure-jira ) step. Use `username` for **Jira Server** or `email` for **Jira on Atlassian cloud** . |
| `Password/API token` | Created in [configure Jira ](#configure-jira ) step. Use `password` for **Jira Server** or `API token` for **Jira on Atlassian cloud** . |
| `Jira workflow transition IDs` | Required for closing Jira issues via commits or merge requests. These are the IDs of transitions in Jira that move issues to a particular state. (See [Obtaining a transition ID ](#obtaining-a-transition-id ).) If you insert multiple transition IDs separated by `,` or `;` , the issue is moved to each state, one after another, using the given order. In GitLab 13.6 and earlier, field was called `Transition ID` . |
2020-07-28 23:09:34 +05:30
2021-03-11 19:13:27 +05:30
1. To enable users to view Jira issues inside the GitLab project, select **Enable Jira issues** and
enter a Jira project key. ** (PREMIUM)**
2020-07-28 23:09:34 +05:30
2021-03-11 19:13:27 +05:30
You can only display issues from a single Jira project within a given GitLab project.
2017-08-17 22:00:37 +05:30
2021-03-11 19:13:27 +05:30
WARNING:
If you enable Jira issues with the setting above, all users that have access to this GitLab project
are able to view all issues from the specified Jira project.
2020-07-28 23:09:34 +05:30
2021-03-11 19:13:27 +05:30
1. To enable creation of issues for vulnerabilities, select **Enable Jira issues creation from vulnerabilities** .
2020-10-24 23:57:45 +05:30
2021-03-11 19:13:27 +05:30
1. Select the **Jira issue type** . If the dropdown is empty, select refresh (**{retry}**) and try again.
2020-07-28 23:09:34 +05:30
2021-03-11 19:13:27 +05:30
1. To verify the Jira connection is working, select **Test settings** .
2020-07-28 23:09:34 +05:30
2021-03-11 19:13:27 +05:30
1. Select **Save changes** .
2018-05-09 12:01:36 +05:30
2021-03-11 19:13:27 +05:30
Your GitLab project can now interact with all Jira projects in your instance and the project now
displays a Jira link that opens the Jira project.
2020-07-28 23:09:34 +05:30
#### Obtaining a transition ID
2018-05-09 12:01:36 +05:30
2018-12-05 23:21:45 +05:30
In the most recent Jira user interface, you can no longer see transition IDs in the workflow
2018-05-09 12:01:36 +05:30
administration UI. You can get the ID you need in either of the following ways:
1. By using the API, with a request like `https://yourcompany.atlassian.net/rest/api/2/issue/ISSUE-123/transitions`
using an issue that is in the appropriate "open" state
1. By mousing over the link for the transition you want and looking for the
"action" parameter in the URL
2021-03-11 19:13:27 +05:30
Note that the transition ID may vary between workflows (for example, bug vs. story),
2018-05-09 12:01:36 +05:30
even if the status you are changing to is the same.
2017-08-17 22:00:37 +05:30
2020-07-28 23:09:34 +05:30
#### Disabling comments on Jira issues
2020-01-01 13:55:28 +05:30
2020-07-28 23:09:34 +05:30
You can continue to have GitLab cross-link a source commit/MR with a Jira issue while disabling the comment added to the issue.
2020-01-01 13:55:28 +05:30
2021-03-11 19:13:27 +05:30
See the [Configure GitLab ](#configure-gitlab ) section and uncheck the **Enable comments** setting.
2020-01-01 13:55:28 +05:30
2018-12-05 23:21:45 +05:30
## Jira issues
2017-08-17 22:00:37 +05:30
2021-03-11 19:13:27 +05:30
By now you should have [configured Jira ](#configure-jira ) and enabled the
[Jira service in GitLab ](#configure-gitlab ). If everything is set up correctly
2018-12-05 23:21:45 +05:30
you should be able to reference and close Jira issues by just mentioning their
2017-08-17 22:00:37 +05:30
ID in GitLab commits and merge requests.
2021-01-03 14:25:43 +05:30
Jira issue IDs must be formatted in uppercase for the integration to work.
2020-07-28 23:09:34 +05:30
### Reference Jira issues
2017-08-17 22:00:37 +05:30
2018-12-05 23:21:45 +05:30
When GitLab project has Jira issue tracker configured and enabled, mentioning
2021-02-22 17:27:13 +05:30
Jira issues in GitLab automatically adds a comment in Jira issue with the
2017-08-17 22:00:37 +05:30
link back to GitLab. This means that in comments in merge requests and commits
2021-02-22 17:27:13 +05:30
referencing an issue, `PROJECT-7` for example, adds a comment in Jira issue in the
2017-08-17 22:00:37 +05:30
format:
2020-04-08 14:13:33 +05:30
```plaintext
2017-08-17 22:00:37 +05:30
USER mentioned this issue in RESOURCE_NAME of [PROJECT_NAME|LINK_TO_COMMENT]:
ENTITY_TITLE
```
2019-03-02 22:35:43 +05:30
- `USER` A user that mentioned the issue. This is the link to the user profile in GitLab.
- `LINK_TO_THE_COMMENT` Link to the origin of mention with a name of the entity where Jira issue was mentioned.
- `RESOURCE_NAME` Kind of resource which referenced the issue. Can be a commit or merge request.
- `PROJECT_NAME` GitLab project name.
- `ENTITY_TITLE` Merge request title or commit message first line.
2017-08-17 22:00:37 +05:30
2018-12-05 23:21:45 +05:30
![example of mentioning or closing the Jira issue ](img/jira_issue_reference.png )
2017-08-17 22:00:37 +05:30
2021-02-22 17:27:13 +05:30
For example, the following commit references the Jira issue with `PROJECT-1` as its ID:
2019-09-30 21:07:59 +05:30
2020-03-13 15:44:24 +05:30
```shell
2019-09-30 21:07:59 +05:30
git commit -m "PROJECT-1 Fix spelling and grammar"
```
2020-07-28 23:09:34 +05:30
### Close Jira issues
2017-08-17 22:00:37 +05:30
2018-12-05 23:21:45 +05:30
Jira issues can be closed directly from GitLab by using trigger words in
2017-08-17 22:00:37 +05:30
commits and merge requests. When a commit which contains the trigger word
2021-02-22 17:27:13 +05:30
followed by the Jira issue ID in the commit message is pushed, GitLab
adds a comment in the mentioned Jira issue and immediately closes it (provided
2017-08-17 22:00:37 +05:30
the transition ID was set up correctly).
There are currently three trigger words, and you can use either one to achieve
the same goal:
- `Resolves PROJECT-1`
- `Closes PROJECT-1`
- `Fixes PROJECT-1`
2019-09-30 21:07:59 +05:30
where `PROJECT-1` is the ID of the Jira issue.
2017-08-17 22:00:37 +05:30
2021-02-22 17:27:13 +05:30
Note the following:
- Only commits and merges into the project's default branch (usually `master` )
close an issue in Jira. You can change your project's default branch under
[project settings ](img/jira_project_settings.png ).
- The Jira issue is not transitioned if it has a resolution.
2017-08-17 22:00:37 +05:30
Let's consider the following example:
2018-12-05 23:21:45 +05:30
1. For the project named `PROJECT` in Jira, we implemented a new feature
2017-08-17 22:00:37 +05:30
and created a merge request in GitLab.
2018-12-05 23:21:45 +05:30
1. This feature was requested in Jira issue `PROJECT-7` and the merge request
2017-08-17 22:00:37 +05:30
in GitLab contains the improvement
1. In the merge request description we use the issue closing trigger
`Closes PROJECT-7` .
2021-02-22 17:27:13 +05:30
1. Once the merge request is merged, the Jira issue is automatically closed
2017-08-17 22:00:37 +05:30
with a comment and an associated link to the commit that resolved the issue.
2018-12-05 23:21:45 +05:30
In the following screenshot you can see what the link references to the Jira
2017-08-17 22:00:37 +05:30
issue look like.
2018-12-05 23:21:45 +05:30
![A Git commit that causes the Jira issue to be closed ](img/jira_merge_request_close.png )
2017-08-17 22:00:37 +05:30
2021-02-22 17:27:13 +05:30
Once this merge request is merged, the Jira issue is automatically closed
2017-08-17 22:00:37 +05:30
with a link to the commit that resolved the issue.
2018-12-05 23:21:45 +05:30
![The GitLab integration closes Jira issue ](img/jira_service_close_issue.png )
2017-08-17 22:00:37 +05:30
2020-07-28 23:09:34 +05:30
### View Jira issues **(PREMIUM)**
> [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/3622) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.2.
2021-03-11 19:13:27 +05:30
You can browse and search issues from a selected Jira project directly in GitLab. This requires [configuration ](#configure-gitlab ) in GitLab by an administrator.
2020-07-28 23:09:34 +05:30
![Jira issues integration enabled ](img/jira/open_jira_issues_list_v13.2.png )
From the **Jira Issues** menu, click **Issues List** . The issue list defaults to sort by **Created date** , with the newest issues listed at the top. You can change this to **Last updated** .
Issues are grouped into tabs based on their [Jira status ](https://confluence.atlassian.com/adminjiraserver070/defining-status-field-values-749382903.html ).
- The **Open** tab displays all issues with a Jira status in any category other than Done.
- The **Closed** tab displays all issues with a Jira status categorized as Done.
- The **All** tab displays all issues of any status.
Click an issue title to open its original Jira issue page for full details.
#### Search and filter the issues list
To refine the list of issues, use the search bar to search for any text
contained in an issue summary (title) or description.
You can also filter by labels, status, reporter, and assignee using URL parameters.
Enhancements to be able to use these through the user interface are [planned ](https://gitlab.com/groups/gitlab-org/-/epics/3622 ).
- To filter issues by `labels` , specify one or more labels as part of the `labels[]`
parameter in the URL. When using multiple labels, only issues that contain all specified
labels are listed. `/-/integrations/jira/issues?labels[]=backend&labels[]=feature&labels[]=QA`
- To filter issues by `status` , specify the `status` parameter in the URL.
`/-/integrations/jira/issues?status=In Progress`
- To filter issues by `reporter` , specify a reporter's Jira display name for the
`author_username` parameter in the URL. `/-/integrations/jira/issues?author_username=John Smith`
- To filter issues by `assignee` , specify their Jira display name for the
`assignee_username` parameter in the URL. `/-/integrations/jira/issues?assignee_username=John Smith`
2017-08-17 22:00:37 +05:30
## Troubleshooting
2018-12-05 23:21:45 +05:30
If these features do not work as expected, it is likely due to a problem with the way the integration settings were configured.
### GitLab is unable to comment on a Jira issue
Make sure that the Jira user you set up for the integration has the
correct access permission to post comments on a Jira issue and also to transition
the issue, if you'd like GitLab to also be able to do so.
2021-02-22 17:27:13 +05:30
Jira issue references and update comments do not work if the GitLab issue tracker is disabled.
2017-08-17 22:00:37 +05:30
2018-12-05 23:21:45 +05:30
### GitLab is unable to close a Jira issue
2017-08-17 22:00:37 +05:30
2018-12-05 23:21:45 +05:30
Make sure the `Transition ID` you set within the Jira settings matches the one
your project needs to close an issue.
2017-08-17 22:00:37 +05:30
2018-12-05 23:21:45 +05:30
Make sure that the Jira issue is not already marked as resolved; that is,
the Jira issue resolution field is not set. (It should not be struck through in
Jira lists.)
2017-08-17 22:00:37 +05:30
2019-03-02 22:35:43 +05:30
### CAPTCHA
2017-08-17 22:00:37 +05:30
2019-03-02 22:35:43 +05:30
CAPTCHA may be triggered after several consecutive failed login attempts
2018-12-05 23:21:45 +05:30
which may lead to a `401 unauthorized` error when testing your Jira integration.
2021-02-22 17:27:13 +05:30
If CAPTCHA has been triggered, you can't use Jira's REST API to
authenticate with the Jira site. You need to log in to your Jira instance
2018-12-05 23:21:45 +05:30
and complete the CAPTCHA.