The site that you are currently viewing is a static version of the Software Factory documentation delivered with the

version v7.2.
For up-to-date documentation, see the latest version.

Jira/GitLab integration

How to connect GitLab Merge Request with Jira issue

Concept

The integration between Jira and GitLab creates a powerful synergy between project management and code development. This connection establishes bidirectional links between:

  • Jira items (Epics, User Stories)
  • GitLab activities (commits, Merge Requests)

NOTE: Creating a GitLab branch from a Jira ticket is not covered in the how-to because it requires the Jira DVCS connector, which is not yet integrated.

Use Case

From Jira

When reviewing a ticket, you have direct access to the associated code changes through links to corresponding GitLab commits or Merge Requests (MR).

Link to GitLab Merge Request into Jira

From GitLab

While browsing Git history, you can easily find the functional context of each change through links to the Jira tickets that motivated these modifications.

Link to Jira Issue into GitLab

How it works

The link information between Jira Issue Id and GitLab object will be added manually by the Software Engineer in the Git commit messages. Then GitLab will be in charge of triggering Jira on Merge Request creation.

sequenceDiagram
    actor Developer
    participant GitLab
    participant Jira-API
    participant Jira-Issue

    Note over Developer: git commit -m "PROJ-123"

    Developer->>GitLab: Push changes
    Developer->>GitLab: Create Merge Request
    activate GitLab
    Note over GitLab: Extract Jira Issue ID<br/>(PROJ-123) from commit/MR
    GitLab->>Jira-API: POST /rest/api/
    Note over GitLab,Jira-API: Payload with MR URL<br/>and GitLab metadata
    Jira-API->>Jira-Issue: Add remote link

A GitLab group/project can be configured to support multiple Jira projects. + Several GitLab projects can be linked to a single Jira project.

Task

Setting Up Jira-GitLab Integration

Note

Jira integration can be configured at group or at project level

Follow official GitLab How-To with these information :

Connection Details

Parameter nameValueDescription
Web URLhttps://jira.dss.thalesdigital.ioFor TDP Jira C2
Jira API URL-Not required
Authentication methodJira Personal Access Token (PAT)See Atlassian documentation to create your token

IMPORTANT: Use a dedicated Service Account to create Jira token

Trigger

Parameter nameValueDescription
Commit⬜(Disabled)Each time a commit is pushed with a JIRA ID in the commit message, a link will be added in the corresponding Jira tickets. Should be disabled to avoid too many (useless) links.
Merge Request✅(Enabled)Each time a Merge Request is created with a JIRA ID in the title or in the description, a link will be added in the corresponding Jira tickets.
Enable comments⬜(Disabled)A Jira comment is created each time a commit or MR is detected. Should be disabled to avoid too many comments.
Transition Jira issues to their final state⬜(Disabled)Manual transition is recommended to check issue DoD.

Jira issue matching

Parameter nameValueDescription
Jira issue regex:<JIRA-PROJECT>-\d+example: PROJ-\d+
Jira issue prefix-Not required
Note

We don’t recommend to enable View Jira issues option because rendering does not work properly

Configure Merge Request template

In the GitLab project:

  • Go to :
    Settings > Merge Rquest > Default description template for merge requests
  • Add %{all_commits} in the text field.

By this way, all last commit messages (with Jira Issue Id) will be automatically added in the MR description


Don’t forget to add the Jira Issue Id in your commit message
For example: git commit -m "[PROJ-123] Fix: memory leak"

References