Commit bc8241fa authored by Marin Jankovski's avatar Marin Jankovski

Reorganize Jira integration document and add clearer descriptions.

parent a56496f1
# GitLab JIRA integration # GitLab Jira integration
GitLab can be configured to interact with JIRA. GitLab can be configured to interact with Jira.
This integration allows you to connect multiple Jira instances to the GitLab instance by allowing
every project to setup it's own connection to Jira.
Once the project is connected to Jira, you can reference and close the issues in Jira directly from GitLab.
## Configuring JIRA
## Table of Contents
* [Referencing Jira Issues from GitLab](#referencing-jira-issues)
* [Closing Jira Issues from GitLab](#closing-jira-issues)
* [Configuration](#configuration)
### Referencing Jira Issues
When GitLab project has Jira issue tracker configured and enabled, users will be able to mention Jira issues and GitLab will automatically add a link to the mention. This means that in comments in merge requests and commits referencing an issue, eg. `PROJECT-5`, will add a comment in Jira issue in the format:
```
USER mentioned PROJECT-5 in PLACE_OF_MENTION LINK_TO_THE_MENTION
```
* `USER` A user that mentioned the issue. This is the link to the user profile in GitLab.
* `PROJECT-5` Jira issue that is mentioned.
* `PLACE_OF_MENTION` Name of the entity where Jira issue was mentioned. Can be commit or merge request.
* `LINK_TO_THE_MENTION` Link to the origin of mention.
![example of mentioning or closing the Jira issue](jira_issue_reference.png)
### Closing Jira Issues
Jira issues can be closed directly from GitLab by using trigger words, eg. `Resolves PROJECT-1`, `Closes PROJECT-1` or `Fixes PROJECT-1`, in commits and merge requests.
When a commit which contains the trigger word in the commit message is pushed, GitLab will add a comment in the mentioned Jira issue.
For example, for project named PROJECT in Jira, we implemented a new feature and created a merge request in GitLab.
This feature was requested in Jira issue PROJECT-7. Merge request in GitLab contains the improvement and in merge request description we say that this merge request `Closes PROJECT-7` issue.
Once this merge request is merged, Jira issue will be automatically closed with a link to the commit that resolved the issue.
![A Git commit that causes the Jira issue to be closed](merge_request_close_jira.png)
![The GitLab integration user leaves a comment on Jira](jira_service_close_issue.png)
## Configuration
### Configuring JIRA
We need to create a user in JIRA which will have access to all projects that need to integrate with GitLab. We need to create a user in JIRA which will have access to all projects that need to integrate with GitLab.
Login to your JIRA instance as admin and under Administration go to User Management and create a new user. Login to your JIRA instance as admin and under Administration go to User Management and create a new user.
...@@ -10,7 +58,7 @@ As an example, we'll create a user named `gitlab` and add it to `jira-developers ...@@ -10,7 +58,7 @@ As an example, we'll create a user named `gitlab` and add it to `jira-developers
**It is important that the user `gitlab` has write-access to projects in JIRA** **It is important that the user `gitlab` has write-access to projects in JIRA**
## Configuring GitLab ### Configuring GitLab
### GitLab 7.8 EE and up with JIRA v6.x ### GitLab 7.8 EE and up with JIRA v6.x
...@@ -27,19 +75,15 @@ Fill in the required details on the page: ...@@ -27,19 +75,15 @@ Fill in the required details on the page:
* `username` The username of the user created in [configuring JIRA step](#configuring-jira). * `username` The username of the user created in [configuring JIRA step](#configuring-jira).
* `password` The password of the user created in [configuring JIRA step](#configuring-jira). * `password` The password of the user created in [configuring JIRA step](#configuring-jira).
* `api version` The version of the JIRA API. By default, version `2` is used. * `api version` The version of the JIRA API. By default, version `2` is used.
* `Jira issue transition` This is the id of a transition that moves issues to a closed state. You can find this number under [JIRA workflow administration](jira_workflow_screenshot.png). By default, this id is `2`. (In the example image, this is `2` as well) * `Jira issue transition` This is the id of a transition that moves issues to a closed state. You can find this number under [JIRA workflow administration, see screenshot](jira_workflow_screenshot.png). By default, this id is `2`. (In the example image, this is `2` as well)
After saving the configuration, your GitLab project will be able to interact with the linked JIRA project. After saving the configuration, your GitLab project will be able to interact with the linked JIRA project.
This will allow users to mention JIRA issues in comments in merge requests and comments on commits by mentioning the issue as such:
`PROJECT-5`.
You can close JIRA issues by writing `Resolves PROJECT-5` or `Closes PROJECT-5` in commits and merge requests. After pushing the commit or merging the merge request, the referenced JIRA issue will be automatically closed.
![example of mentioning or closing the JIRA issue](jira_issue.png) ### GitLab 6.x-7.7 with JIRA v6.x
**Note: GitLab 7.8 and up contain various integration improvements. We strongly recommend upgrading.**
### GitLab 6.x-7.7 with JIRA v6.x
In `gitlab.yml` enable [JIRA issue tracker section by uncommenting the lines](https://gitlab.com/subscribers/gitlab-ee/blob/6-8-stable-ee/config/gitlab.yml.example#L111-115). In `gitlab.yml` enable [JIRA issue tracker section by uncommenting the lines](https://gitlab.com/subscribers/gitlab-ee/blob/6-8-stable-ee/config/gitlab.yml.example#L111-115).
This will make sure that all issues within GitLab are pointing to the JIRA issue tracker. This will make sure that all issues within GitLab are pointing to the JIRA issue tracker.
...@@ -64,12 +108,5 @@ Next, go to the services page and find JIRA. ...@@ -64,12 +108,5 @@ Next, go to the services page and find JIRA.
1. Optional: supply the JIRA issue transition ID (issue transition to closed). This is dependant on JIRA settings, default is 2 1. Optional: supply the JIRA issue transition ID (issue transition to closed). This is dependant on JIRA settings, default is 2
1. Save 1. Save
Now we should be able to interact with JIRA issues, for example we can close a JIRA issue by commiting to our GitLab repository and referencing the JIRA issue( in the format of JIRAPROJECT-123). Now we should be able to interact with JIRA issues.
For example, for project named NEW we commit with a commit message `Add new file fixes NEW-1`:
![A Git commit that causes the JIRA issue to be closed](jira_service_commit.png)
That will close an issue NEW-1 in JIRA and add a comment with a link to the commit that closed the issue:
![The GitLab integration user leaves a comment on JIRA](jira_service_close_issue.png)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment