Transition jira issues from gitlab commit
Raise your hand if you are a lazy developer, because you are welcome to join my gang 😄, yes I am a lazy developer and every sprint starts to the finish i always forget to move my jira issues, then i found the solution to move my jira issues from my commit, let me tell you how to set it up.
Integration gitlab with jira for sync activity
First Open your gitlab project > setting > integration > add integration jira
, you will see screen like below.
Check active for enable integration
, then choose the trigger
, for the comment detail i think i just need standard but you can choose all details if you need, when you select enable jira transitions
, the screen will show Move to Done
and Use custom transitions
because i want my jira issues can move base on my jira workflow, to get transition IDs you can click setting(gear icon in top right corner) > issues > workflows > edit > select text button
or you have to move your jira issues to board, and open this Url in your browser <host_atlassian_url>/rest/api/2/<issue_key>/transitions
As you can see above now you get the transition IDs, the transition will be same like in your details jira issue
next you have to enter web URL field
with your base_atlassian_url
, for Jira API URL
i leave it blank because i’m using jira cloud, but if you use jira server you can check here, for username and email
i fill it with my email, to get the API token
you have to open jira > account picture > security > create and manage API token > create token with your project name
then click test setting
in gitlab, if everything is fine than click save change
, let’s check if our gitlab is already integrated with create a merge request.
The image above show that your gitlab already integrated activity with jira, the web links
and Activity
generated when you did merge request, but you still can’t move you jira issue right now, so let’s do the next step.
Integration gitlab with jira for DVCS (distributed version control system)
Actually there are two methods for transition in jira, you can install gitlab with jira app or this method, because i use gitlab on premise so i choose this method, for integration DVCS open gitlab > profile picture > preferences > application
you can name it anything you want, but in this example i name it with jira and fill Redirect URI
with
then click save, if anything ok then gitlab will generate Application ID
and Secret
, next open your jira and click setting(gear icon in top right corner) > product > DVCS account > Link GitHub enterprise account
you need to be an administrator to access this.
In your Team or User Account
field, input your gitlab group name or project name, and add your gitlab host URL, Client ID
and Client Secret
is your Application ID
and Secret
you get before in gitlab, then click Add. Jira will access your gitlab by group or project you name it in Team or User Account
so you have to make sure to enter the right group or project name, if everything is fine you will see your repository linked like bellow.
Now let’s create a commit and merge again but with this format <issue_key> <ignored text> <#transition-name>
like example bellow
git commit -m “MIXN-9085 this feature is ready to QA #Kanban-issue-is-in-QA”
The transition name are case sensitive so you have to write them correctly and if your transition name have a space like mine, change the space with dash ( — ), now merge the commit and check your jira issue, you can see the development process in gitlab (like branch, commit, pull request etc) but the issue isn’t moving.
It’s because DVCS connector updates data only once per hour, but we can refresh it manually, so open repository in DVCS an click refresh.
And now your jira issue will move like below 🎉
ok thanks for reading this article till the end, hope this method make your life easier, furthermore maybe you can make this as your rule to commit in your gitflow 🙏
Reference : https://docs.gitlab.com/ee/integration/jira/