Linking GitLab accounts
You can link your GitLab and GitLab Enterprise accounts and their repositories to Jira, and see the development information from pull requests displayed in your issues.
Here’s a list of supported versions:
|Jira version||GitLab||GitLab self-managed|
Prerequisite: Integrate Jira with GitLab using OAuth 2.0
Before you can add your GitLab account to the DVCS accounts page, you need to integrate Jira with GitLab using OAuth 2.0.
To create the OAuth 2.0 integration in Jira, you need to be a Jira System Administrator.
To add a new OAuth 2.0 integration in Jira:
Go to Administration > System > OAuth 2.0.
Select Add new integration.
In Service provider, select Custom.
Enter your integration’s name.
Don’t worry about the Client ID and Client Secret right now. You’ll get them from GitLab in the next steps.
Enter the authorization and token endpoint, as shown in the table below.
GitLab type Authorization endpoint Token endpoint GitLab.com GitLab self-managed
Copy the Redirect URL. You’ll use it in GitLab in the next step.
Leave your Jira configuration open and move to GitLab to create a new application. This will give you Application ID and Application Secret that you’ll use in Jira.
In GitLab, go to User Settings > Applications, and add a new application. Use the following data:
Redirect URI: Enter the URL you copied from Jira.
Confidential: Keep that enabled.
Scopes: Select api. This is required for the DVCS connection to work.
- After creating the application, you should get the Application ID and Application Secret, like on the image below.
In Jira again
Go back to your configuration in Jira, and enter the missing information to complete the integration.
Enter GitLab’s Application ID as Client ID.
Enter GitLab’s Application Secret as Client Secret.
In Scopes, select api.
Save the integration, and then select Test Connection to make sure everything is right.
Link your GitLab account
With the OAuth 2.0 integration created, you can use it when linking your GitLab account on the DVCS accounts page.
In Jira, go to Administration > Applications > DVCS Accounts.
Click Link an account.
In the Host drop-down, select GitLab or GitLab Self-Managed.
For GitLab Self-Managed, enter your GitLab Host URL.
For Gitlab, the Host URL is fixed to https://gitlab.com.
In the Team or User Account, enter the target group and optional subgroups.Requirements for entering groups and subgroups...
Groups must be entered as groupA/sub-groupA/sub-sub-groupA.
You can only have one group active as a configuration at one time. For example:
If an existing integration is already using groupA, you won't be able to use groupA/sub-groupA in your new integration.
Likewise, if an existing integration is using groupA/sub-groupA, you won't be able to use groupA in your new integration.
All spaces must be changed to dashes (-). For example, a group My projects needs to be my-projects. This also applies to subgroups: My Projects > More Projects would be my-projects/more-projects. Another way to get this right is to access your group on Gitlab, and copy the URL, for example http://gitlab.com/my-projects/more-projects.
- In the Client Configuration, select the created OAuth 2.0 integration. If you have only one, it will be automatically selected.
- Click Add.
Here’s what happens after adding your account:
Syncing repositories: Your account appears on the DVCS page and Jira starts syncing its repositories, if you decided to link them automatically. For details, see Integrating dev tools using DVCS.
Matching issues: If your commits and pull requests include issue keys, Jira will try to find them and add the relevant information to your issues. For details, see Referencing issues in your development work.
Displaying dev info: If referenced correctly, the dev information will be added to your issues to give everyone involved more context. For details, see Viewing the dev info for an issue.
Workflow triggers: One of the benefits of integrating your development tools is adding workflow triggers that, for example, lets you change the issue status after you create a new branch. For details, see Configuring workflow triggers.