« Table of Contents

gitlab server logo GitLab Server EE/CE Integration1 Jira Cloud

This feature tracks added or deleted repositories from a remote GitLab server (EE/CE) and automatically imports those Git repository references into Jira.

GitLab v10+ stopped accepting username/password credentials for API access and will only recognize Personal Access Tokens (PAT) and OAuth authentications.  Service users are strongly advised to switch from using username/password for newer versions of GitLab Server (CE/EE) to using Personal Access Tokens.

For GitLab Server service users, they won't see the issue until they upgrade their GitLab Servers to version 10 and higher.  Git Integration for Jira app offers pre-v10 GitLab Server service users as a Legacy connection option.

helpful tip
BigBrassBand recommends a dedicated service user for this integration which has access permissions to the GitLab git repositories.

Permissions

GitLab can have users with different access level to a group or project.  If the user's connected GitLab repositories to Jira are not accessible or commits are not showing for that user -- it's related to permission issues. This can be a per user, repository or a project level restriction.

If you encounter access permission issues, you will need to ask your Git administrator to grant you the required level of access to specific projects. If you are a Git administrator, you will need to setup a GitLab user with the minimum required permissions to view GitLab projects from Jira.

Take the following cases for example:

  • the personal access token (PAT) that the GitLab user provided doesn't have the correct permisions within GitLab to view source code for specific repositories.
  • the GitLab user doesn't have access privileges to a GitLab repository or is not a member of a group that has access to specific repositories.

We recommend creating a specific GitLab user for the integration.  This way, the GitLab user can have specific permissions to do the given tasks.

For minimum access (read-only) permissions:

  1. Set the user account profile's PAT scope to read_repository.
  2. The GitLab user is set to only read a specific repository.  Set to Reporter role.

This level of access allows the user to view commits for the specific repository.

For users who will be tasked with creating branches and merge requests:

  1. Set the user account profile's PAT scope to api.
  2. The GitLab user should be set to read/write access for the specific repository.  Set to Developer role.

This level of access allows the user to create/delete branches and create merge requests.

For more information, see GitLab Permissions new tab/window icon.

Connecting to a GitLab Server via Auto-ConnectJira Cloud

This process requires an existing GitLab Server EE or GitLab Server CE.  If your GitLab Server version is 10.2 and newer, a personal access token must be configured.

  1. On the Jira Cloud dashboard menu, go to Git > Manage Git Repositories.
  2. The git configuration page for connecting repositories is displayed.
  3. On the Auto-connect integration panel, click GitLab.
  4. On the Connect to GitLab screen, select the External service from the dropdown list.
  5. Choose:
    • GitLab Server (CE/EE) Legacy  –  if your GitLab Server version is 10.1 and older.
    • Enter the Host URL of the GitLab server.  Enter the username and password credentials for server authentication.  If 2FA is enabled in your GitLab Server, enter the personal access token as the password.
    • GitLab Server (CE/EE)  –  if your GitLab Server version is 10.2 and newer.
    • Enter the Host URL of the GitLab server.  Enter the username and PAT credentials for server authentication.  2FA must be enabled in your GitLab Server and PAT has been configured.
  6. The Advanced option is only available for GitLab Servers in Jira Cloud.  Click Advanced to expand the option to enter the query string parameters.  This setting is used with integration to retrieve list of tracked repositories.  Set a filter that will only load some cloned repositories which can be viewed via Actions > Show tracked repositories in the Manage git repositories configuration screen.
  7. On the following screens, import detected repositories then configure repository settings if required to complete the import process.
  8. note
    Currently the Git app scans only the repositories visible to the user which is used for scanning.  The repositories which are publicly visible (shared for all members or visible to the member with the admin rights) will not be scanned.  This will be supported in a future release.

The GitLab server is added to the repositories list as a connected server and is automatically reindexed.

Manage repositories of a connected GitLab server via the Git Repositories page under cog Actions  > Show tracked repositories to modify tracked repositories settings.

Repositories added or removed from GitLab server will be likewise added or removed from Jira Cloud.

fyi
The Git Integration for Jira app supports v3 and v4 of the GitLab API (in both Jira Cloud and Jira Server).
helpful tip
For newer GitLab authentication - in order to access a Git repository over HTTP, use the username as the username and the PAT for the password.
Admin/Power Users:
To pass the private access token (for example: XpigzF1JxMnAZ7mn9qgN) to an API call with GitLab.com:
curl --header "Private-Token: XpigzF1JxMnAZ7mn9qgN" https://gitlab.com/api/v4/projects?membership=true

Single Repository Connections

This process requires an existing GitLab server git repository.  For starters, the GitLab server repository URL can be acquired on the repository project page.  Choose between SSH or HTTPS.

Use this information to connect the GitLab server git repository to your Jira server via Git Integration for Jira app: Manage Git Repositories > Connect to Git Repository.

fyi
The Git Integration for Jira app supports v3 and v4 of the GitLab API (in both Jira Cloud and Jira Server).

Working with Branches and Merge Requests with GitLab CE/EE Jira Cloud

For GitLab CE/EE (Legacy or newer), the user must have the Write permissions and the api PAT scope.

  1. On your Jira Server, open a Jira issue.  On the Jira developer panel under Git Source Code, click Create Branch.
  2. The Create Branch dialog is displayed.
    • Select a Repository from the list.
    • If there are several repositories with the same name, the listed GitLab repositories will have their names attached with a GitLab owner name.  For example, johnsmith/second-webhook-test-repo.
    • Choose a Base branch.
    • Enter a Branch name or leave it as is (recommended).
  3. Click Create Branch.  The newly-created branch is now listed in the developer panel under Branches.

Perform a commit to the newly-created branch to be ready for merge.

Merge Request

The merge request feature works the same as pull request.

To create a merge request and merge it to the main source (master):

  1. On your Jira Server, open the Jira issue where your previously created a branch.
  2. On the developer panel under Git Source Code, click Create merge request.
  3. The Create Merge Request dialog is displayed.
    • Select Repository from the list.
    • If there are several repositories with the same name, the listed GitLab repositories will have their names attached with a GitLab owner name.  For example, johnsmith/second-webhook-test-repo.
    • Choose the newly-created branch as the Source branch.
    • Set master as the Target branch.
    • Enter a descriptive title or leave it as is (recommended).
  4. Click Create to create the merge request.

The merge request is listed on the developer panel of the Jira issue page.

The merge request is also ready for approval by the reviewers in your GitLab CE/EE web portal.

 

« Table of Contents