Jira is a popular product tracking product that is often used to facilitate smooth software development. It comes with support for Atlassian’s own source controller, BitBucket, which links questions directly to commitments, but you can also enable the same support for Gitlab.
What does integration do?
Basically, the Jira integration for Gitlab allows you to link Jira issues to Git commits. Whenever changes are sent to Gitlab, it will check if any Jira issues are mentioned in the communication message or description and add a comment to the issue.
This is a simple feature, but it is important to link the two platforms. Let̵7;s say you give a developer a set of problems to work with in a code snippet. That developer creates a lot of commitments and pushes them to Gitlab when the tasks are complete and mentions problems in the process. When the project manager goes through Jira, they can quickly see the related commitments for any issues, as there will be links to each commitment in the issue.
This also works elsewhere – from Gitlab you can quickly see what problems a commitment mentions. This usually saves you just one click, but it is a nice feature to have when you have many problems.
With the integration, you can also automate the closing of problems from communicating messages. If you require developers to move issues from “Ongoing” to “Under review”, you can configure Gitlab to do so when someone writes ”
Resolves PROJECT-1 “In a communicate message.
The same features are also supported for merge requests, useful for when you have a developer working on their own branch that needs to be merged into a master.
Set up the Jira integration
The Jira integration is configured per project, so go to your project page and click on “Settings”> “Integrations”:
First of all, you want to activate the integration in the first place by selecting “Active”. You can also turn off the triggers for comma and merge requests, but you probably want them.
Then set up your Jira URL. If you use Jira’s managed cloud version (at atlassian.net), enter your
companyname.atlassian.net URL. If you host Jira yourself, you’ll enter the URL of your instance, probably something similar
jira.companyname.com. Alternatively, if you host Jira yourself and place the API on another domain, you will want to enter it here.
If you use Jira’s cloud version, you want to enter your email and an API token, which you can get from this page. Create a new token and paste it into the box in Gitlab. This authenticates Gitlab to your Atlassian account. If you use Jira as your own host, you simply want to enter your username and password.
In any case, you probably want to create a service account so that messages are displayed from “Gitlab” rather than your personal user account. If you do not want to pay for an extra account, your personal will work well.
Then you need to give Gitlab a list of transition IDs. These define the different phases, for example “Todo”, “Ongoing” and “Done”. It’s strange that Gitlab does not configure this automatically, but you can get a list of them from the Jira API by going to the following URL in your browser:
Note that you will need to replace “your company” for your actual Jira URL and sub in “EDITION-1” for a real problem ID. This will provide
var x = `paste response here` console.log(JSON.parse(x).transitions.map((d)=>d.id).join(','))
Which will return something similar
11, 21, 31 (default) that you will enter in the Transition ID box.
Using the Jira integration
The use of the Jira integration is quite simple. There are no boxes to check or levers to pull, just mention a Jira Issue ID anywhere in an engagement topic or description, and Gitlab will automatically post a comment on the issue that links to the engagement page:
This is nice and everything, but being able to close questions from commitments is even better. There are currently three trigger words that you can use to close a problem:
- Solves PROJECT-1
- Closes PROJECT-1
- Fixes PROJECT-1
You can write these inline in communicating messages or descriptions:
Each of them will do the same thing – move the related issue to the most recent transition ID you entered in the list. If you do not want developers to move issues directly to “Done”, you can configure Gitlab to send commitments to “In Review” instead by excluding the transition ID for the unwanted categories.