How and Why to Integrate Gitlab with JIRA

Continued from page 1.

In addition to updating the JIRA ticket, the previous commit message will also get added to GitLab, as a "merge request" candidate, allowing the merge request reviewer to refer to the commit message as well as the JIRA ticket that it's associated with (WebLaunch-10). This is the benefit: With one commit message, the JIRA ticket gets updated, GitLab gets updated with the commit message, and the resolutions of both JIRA and GitLab change, automatically.

In the following partial screenshot of GitLab, you can see how a merge request reflects the JIRA issue it's linked to (in this case, "Project-7") within the merge request and how the acceptance of the merge will result in the closure of that issue.

Closing JIRA Issues Within git

This also has the added benefit in the long term by tying commits to specific issues, making regression testing and diagnosing bugs a lot easier through time with the ability to trace the resolution to a specific commit in time.

Other Advanced Actions Through Smart Commits

Through what is referred to as smart commits, developers can perform additional advanced actions. By following the syntax format of:

<ISSUE_KEY> <COMMAND> <optional COMMAND_ARGUMENTS>

Developers can perform additional actions like:

  • Comment on an issue
  • Record time tracking information against an issue (i.e., worked one week and two days on an issue)
  • Transition to a particular workflow state (i.e., Start Progress, Start Review)

If a developer on a project titled "WebLaunch," wishes to comment on issue number WebLaunch-42, log some time worked on the issue or transition the workflow state to Start Progress, the developer could use the following statements from within GitLab:

WebLaunch-42 #comment I need to get more information on this
...
WebLaunch-42 #time 1w 2d 4h 30m Total work logged
...
WebLaunch #start-progress Started this today
...

Chaining Multiple Actions Together in One Commit

Beyond simple commit statements developers can chain together multiple actions in a single commit line from within GitLab. The following statement would close both the WebLaunch-42 and WebLaunch-10 issues:

WebLaunch-42 WebLaunch-1 #close This task has been closed

Or by adding the following commit statement, have both WebLaunch-42 and WebLaunch-1 issues record a time of two days and hours hours, while adding a specific comment and closing the issues:

WebLaunch-42 WebLaunch-1 #time 2d 5h #comment Task completed ahead of schedule #close

As you can see, chaining actions together in one commit saves developers even more time and hassle, while ensuring the project managers get all the information in a timely and accurate manner.

How to Integrate GitLab with JIRA

In this tutorial, you'll learn how to:

  • Creating a JIRA account
  • Configuring JIRA
  • Configuring GitLab

Let's start off first by creating a new JIRA account.

Creating and Setting up a JIRA Account

Atlassian offer both a self-hosted license tier, as well as a cloud license tier, of which you can start off with a free trial. For the purpose of this tutorial, you'll use cloud-based licensing, so go ahead and register for a free trial.

Be sure to read the next Application Development article: How to Hide API Keys When Building Web Apps On CodePen

 

Comments (0)