• Article
  • Sep.29.2020

How to make the most of Jira Software and Bitbucket

  • Sep.29.2020
  • Reading time mins

Atlassian applications have evolved from a software development only toolset to a much wider spectrum of features. They can now help virtually any department, from service desk to business teams. However, one of the main ‘niche-targets’ is indeed the software development market, especially the features designed for developers. We see a great deal of Atlassian effort to integrate all of your tools like Jira, Confluence, Bitbucket, and Bamboo. These integrations not only ensure an easy way to bundle the applications, but it also makes the user experience much more pleasant

In this blog, we will explore the integration between Jira Software and Bitbucket, and we will highlight how you can make the most of the features available when you have these applications working together. If you are new to the Atlassian ecosystem, here we have a brief description on Bitbucket and Jira:

Bitbucket was acquired by Atlassian in 2010 and never stopped growing. It’s designed to offer rich management features to control your git repositories. It is available on Cloud (Hosted by Atlassian) or Self-Hosted (Data Center version). You can track and manage the changes on your git commits as any other GIT tool would do, however, with Bitbucket you can do a lot more! This is where you can organize the repositories in projects, set permissions to tell colleagues who will do what, collaborate with your team, and so on. We will see some of these features in this Article. Nonetheless, it is an amazing tool, heavily supported, and has extensive documentation for you to get started.

 

 

 

Now let’s have a look at Jira! This is surely one of the most well-known issue trackers on the planet. The core goal of Jira is to allow tasks to be organized into projects. You can set each project to reflect the processes you follow daily, using issue types to represent the tasks and workflows to tell Jira how to behave each step of the way you work! Permissions are set for each project, which ensures only the relevant personnel can access the projects’ details. For development projects, by default on Jira you have: Kanban and Scrum Boards, powerful JQL (Jira Query Language) to search your issues, and keep track of your tasks, Releases, Backlog, Sprints, literally everything you need to apply Agile methodologies to your work. Whether you are new to Agile or you are already using it, Jira can help your team to be much more efficient. If you are not using Jira yet, please spare some time and try it out!

 

 

How can we make the most of the integration between Jira and Bitbucket?

Let’s assume here that you already have your Jira and Bitbucket up and running. Your projects are set up on and you are ready to start your work. So, how does the integration work? As any of the Atlassian suite tools, the integration is done through a feature called “Application Links” on Server to Server scenario (how do I use it? Please have a look here Using Application Links), for Cloud to Server or Cloud to Cloud, Jira will use DVCS Accounts (There are some useful documentation links at the end of this article). It is a built-in option that allows easy linking between Atlassian tools. If you have everything in place, you can integrate Jira and Bitbucket in less than a minute! Once it is complete, the fun begins.

For most of the integration features all you need to do is include the issue key (the task you are working on) into the Bitbucket actions, such as commits, branches, pull requests, etc. This is because the integration works directly in the issues, it is not related to your project. So, the most simple example is, when doing your commit, simply add the issue key into your comment. This will allow you to see details about the commit in your Jira issue view and also see issue details on your commit view inside Bitbucket. Easy, isn’t it?

git commit -m "Create new view for users - Requested on Task VLTS-999"

Now we are ready to dig a bit more into this.

The general rule here is: add the issue key everywhere! Add the issue key in the commits comment, as shown above, when creating a branch add the key into the branch name, same for Pull Requests, if the name has the issue key, they will be linked automatically and appear on Jira. So now you have the idea, through the issue key, Jira and Bitbucket will work together and make your life easier.

What can you do in Bitbucket directly from Jira?

Evaluate the status of a Jira issue’s development at a glance. View and create branches and pull requests and view commits without leaving Jira. Automatically link code to Jira. Automatically link issues and keep your team up to date. Create a branch from a Jira issue or add issue keys to a commit, branch, or pull request to link them.

On the Jira side, the core of the integration is on the issue view, the almighty Developer Panel: there you will find all details about your Bitbucket activities, and from there you can find the options to create branches, pull requests and even test/build actions.
You will find on the right (for Server or Cloud), the DEVELOPMENT section, with details about your integration with Dev Tools on this case.

Bitbucket:

 

 

 

Once you click on these links, you will have this screen with all the options available. You can see all commits related to this ticket, Branches, Pull requests, Builds, and Deployments.

 

 

 

Once the integration is in place, it is easy, no more mess will be created by copying and pasting links or comments to inform your team what you have done on your commits. Everyone will easily be able to track the tasks linked to commits. It is very convenient for you and your team to keep an eye on dev activities, even if they don’t want to switch to Bitbucket to find the information they need.

The information available in the Development panel (valid in Bitbucket Cloud and Bitbucket Server): Branches, Commits, Pull requests, Reviews (valid in Crucible), Builds and Deployments. For more details check Viewing the development information for an issue.

How about changing your Jira issues from Bickcuket?

What can be better than having full visibility? Regardless of the App, you are in, Jira or Bitbucket, you have the details you need. If you are on Bitbucket, you don’t need to switch back to Jira to be able to view, create, or transition issues, you can do it all inside Bitbucket!

This is all good stuff, especially considering that developers will not spend much time on Jira, but working on their code, and then committing it on Bitbucket to get ready for testing and deploy. That is why many of the features on this integration between Jira and Bitbucket will come from Bitbucket actions, lets check some of them. The idea is to make it easy as possible for the developers working across the tools, so you can create actions on Bitbucket from Jira, as we saw previously – an action on Jira from Bitbucket, including automation, so you don’t need to worry about repetitive actions, the integration will do that for you.

There are serious advantages when you have these tools integrated. Remember the times you had to do your changes on Bitbucket and then go on Jira to update your ticket? How about these new features that will cover it all for you:
From Bitbucket you can transition linked issues, add new comments directly from your commit message, view and add new files into the Jira ticket, check subtasks, and linked issues. The list goes on, you can even view all tickets/projects related to commits in your repo. Isn’t it amazing?

So, how does it work on Bitbucket?

Most of the things we will get by only clicking at the link generated on the issue key, as you can see below, the image shows the link, then you have a panel that is just like the Jira issue view you have in Jira. Simple as that, no more switching browser tabs, copying, and pasting, it is all there for you.
Wherever the Issue Key is added, it will become a link, so you can click and access the issue details (as shown in the next image).

 

 

 

This view is inside Bitbucket, it is just like what you have in Jira.

 

 

 

Automations, at last!

One of the key advantages of the integration between the Atlassian tools is the built-in automation. You can automatically transition issues on Jira as work progress in Bitbucket. Always add the issue key into your commits comments (also branch and pull request) to keep your team aware of all changes in your tasks. They will be able to see the details on Bitbucket and in the Jira issue development panel.

As mentioned before, you can transition issues from Bitbucket. This can be achieved by Smart Commit or Automations. Let’s talk automation first. To achieve this feature we need to work with what is called Workflow Triggers. This will not only reduce the number of actions a developer has to execute, but will also keep consistency and reduce the risk of human error. The idea here is to tell Bitbucket how to act on the linked Jira ticket when an action happens, such as committing code, updating reviews, or creating branches. There the trigger will transition the ticket automatically, so the developer won’t need to worry about which status the ticket should go. For example, you can set a trigger to automatically transition a Jira issue from ‘In Progress’ to ‘Done’ when your pull request is merged.

Here are the events you can use on your issues:

Events
  • Pull request created
  • Pull request merged
  • Pull request declined (Bitbucket only)
  • Pull request reopened (Bitbucket Server only)
  • Commit created
  • Branch created

On your workflow, you add the events are triggers. Jira will be listening to any of the events configured, so when Bitbucket signals Jira about an event, if it matches with your workflow trigger, then it will activate the transition.

 

 

 

 

 

 

Please check the Atlassian documentation to get started on workflow triggers.

Going forward, there are still many ways to interact with Jira from Bitbucket. Using smart commits. This is a true love for developers!

What is it exactly? Smart Commits are a set of commands you can add to your commits that will trigger an action on the Jira ticket mentioned on the commit comment. Here are the 3 cool commands you can use: commenttime, and transition.

This is the syntax you should apply:

<ignored text> <ISSUE_KEY> <ignored text> #<COMMAND> <optional COMMAND_ARGUMENTS>

To illustrate how handy smart commits can be, there is an example of how to use multiple commands on a commit. This one will log time to your ticket (instead of you doing it manually on Jira after finishing your task), add a comment, and transition the issue using the transition “resolve”. Of course, it all happens in the right way when you mention the Jira issue key:

git commit -m "DEV-1 #time 1d #comment Login Form complete complete #resolve"

So, on my story Workflow, I have a transition called resolve. When this commit is done, my issue DEV-1 will be moved to a new status, my comment will be added to the issue and my hours worked included. The job was done in a single line.
Atlassian has good documentation on how to use smart commits, go ahead, and start using it, it is a win-win scenario!

The final details you should know

As you can see, one requirement, the most important one, is that you keep the issue keys present in the Bitbucket actions, such as commits, branches and pull request names, etc. You might forget to do it while working on Bitbucket directly, but when you do that from Jira it will link the issue automatically. However, when you are committing your code, Jira can’t control that, so on Bitbucket, there is a feature to enforce that all commits must include an issue key. This is super easy to set up – just go into your repository’s settings and find the menu links. Now all you have to do is switch on that option and you are done.

 

 

 

Now, whenever a developer tries to commit without an issue key in the comments they will get an error saying that an issue key is required. There are plenty of features for you to try out. Hopefully, you will get up to speed with all of them and it will make your life easier. Try it, learn, and share it with your colleagues! The integration is meant to maximize your time and ensure you keep collaborating even more.

Do still need some help with Bitbucket? Don’t hesitate to search on the Atlassian documentation, they are great and most likely will get your question resolved, otherwise, here are some useful links regarding Jira and Bitbucket integration. In case your team needs help with Bitbucket or anything related to Atlassian tools, Valiantys can help.

Integrating Bitbucket and Jira – Documentation

Server to Server

Cloud to Server

Cloud to Cloud

More about Bitbucket

Integration tips 

Conclusion

Jira and Bitbucket are, without question, great tools and are already heavily used by many developments team around the world. So why not take some time to test out the features available? They will power up your skill on Bitbucket and *for sure* be great for team collaboration, and that’s not mentioning the potential they have to make your life easier. Go ahead and enjoy all the cool features, you will not regret it!

While you are here, take some time to have a look at some other articles, they are all related to Atlassian tools and may help you or your team to make the most of tools such as Jira, Confluence, Bamboo and more. Check our article comparing Bitbucket and Github.

And if not, feel free to send us any of your questions!

 

Contact one of our consultants now

Related resources

View all resources