How to install and configure the Jira Git plugin with Gitlab
Introduction
Before I continue let me tell you that the Jira Git Plugin that I will talk about is not supported by Atlassian” target=”_blank"> but Marcello Teodori added support for version 5 of Jira. If you want a supported plugin you can see the Git Version Control Viewer supported by BigBrassBand, I will not talk about it because I didn’t try it.
Requirements
- Gitlab v3.0.*
- Jira v5.0.x
Let’s start
First of all, you should know that it can be done with two different environments:
- Having Jira in one server and Gitlab with git in other server
- Have both in the same server
Step 1 - Install the Jira Git Plugin
- Open Jira
- Go to: Administration > Plugins > Manage Plugins
- Click on “Upload Plugin”
- Add the url for the plugin: https://github.com/downloads/mteodori/jira-git-plugin/jira-git-plugin-0.6.1-SNAPSHOT.jar
- Click on upload
By now you should have Jira Git Plugin installed.
Step 2 - Configure the Git repositories
For every single repository you will need to clone it and add the configuration for it inside Jira. Since you can have two different environments let’s do it for both.
1. Jira and Gitlab on the same server
-
git clone (with or without –bare) the source tree that you need (run as the same user that Jira runs as). Ex.: git clone –bare git@localhost:test /home/jira/repositories/test
-
Go to: Open Jira > Administration section > Plugins > Git Repositories > click on Add
-
Display Name: Your repository name. Ex.: Test
-
Repository root: Directory where you cloned your repository. Ex.:
/home/jira/repositories/test
-
Repository Origin: The url you used to clone the repository. Ex.:
git@localhost:teste.git
-
Web Linking: For the current version of Jira Git Plugin does not exist the default Gitlab formats but you can add them manually:
-
View format:
http://<gitlab server>/<repository>/master/tree
-
Changeset format:
http://<gitlab server>/<repository>/commits/${rev}
-
File added, modified and deleted are the same formar:
http://<gitlab server>/<repository>/commits/${rev}#${path}
2. Jira and Gitlab on different servers
You have two choices here:
- Add the private ssh key of gitlab user to the user that Jira runs
- Create a new user on Gitlab for Jira and generate the ssh key for that user on the Jira server.
First one:
- Copy the ssh key of the gitlab user (on the Gitlab server) to the user that Jira runs as (on Jira server)
- Now you can follow the Jira and Gitlab on the same server steps
Second one:
- Generate the ssh key for the user that Jira runs as (on Jira server)
- Create the Jira user inside Gitlab
- Add the public ssh key for the user that you create on step 1
- Add the user to the repositories you want (at least with the reporter role)
- Now you can follow the **Jira and Gitlab on the same server **steps
edited: added the Jira version supported by this plugin