4 min read

Why every Bitbucket Admin needs ScriptRunner

Why every Bitbucket Admin needs ScriptRunner

Why every Bitbucket Admin needs ScriptRunner

If you're a Jira Admin, you will most probably have used or heard of ScriptRunner for Jira. However, you may not yet be aware that ScriptRunner for Bitbucket provides you with similar automation and customisation capabilities for Bitbucket Server.

Bitbucket Server is a popular repository tool amongst developers and development teams. With millions of users - and with the recent acquisition of GitHub by Microsoft - Bitbucket is fast becoming the preferred platform for all your storage needs.

As a Bitbucket Administrator, you have a lot to keep in check, such as making sure that all code commits are adhering to a process, or ensuring agreed naming conventions are used across all your GIT commits.

But how do you ensure these processes are automated rather than manually checked? The answer to this and many other "how do I make Bitbucket do this automatically?" is ScriptRunner.

ScriptRunner for Bitbucket Server provides you with three great benefits;

  1. Automation of manual tasks in BitBucket
  2. Regulation of standards for data compliance & auditing, and
  3. Creation of reports on Bitbucket storage usage

Let's look at each benefit in a bit more detail.

Automating manual tasks in BitBucket

Using ScriptRunner, you can set up automated scripts that will carry out an otherwise laborious manual task for you. For example, let's say you want to clone a repository, out-of-the-box Bitbucket will not let you do this, but ScriptRunner has something called a 'built-in script,' which enables you to carry out a repository clone within a few clicks, as you can see below.

clone repository

There are a lot of built-in scripts that allow you to do point-and-click automation in ScriptRunner; configure a mirrored repository between Bitbucket and GitHub/Bitbucket Cloud, switch to a different user - when you want to resolve support queries, and many more.

There is another feature called 'Scheduled job' which is an automated script that you can choose to run at recurring intervals. So if there's a Bitbucket task that you need to perform on a recurring basis, you can automate it using ScriptRunner.

image2018 7 31 15 52 24

Regulating data compliance and auditing 

The real meaty functionality that ScriptRunner unlocks is setting governance protocols for your team. This means you can control how your GIT commits are pushed to Bitbucket, whether you want them to follow a branch naming convention, or restrict the storage file size so that when a certain threshold is reached an error message like this will appear:

image2018 7 31 17 34 41

One of our favourite compliance scripts allows you to enforce the association of a Jira ticket with a commit, resulting in end-to-end tracking for your development team, between Jira and Bitbucket. You can select this script in the 'Pre-receive Hooks' list, as in the example below: 

pre hooks list

Selecting this script option, ensures your team follow the enforcement process, otherwise their commit will be automatically rejected, as in the example below:

image2018 7 31 17 38 4

You can also set up maximum storage size alerts, so ScriptRunner can integrate with an email system to send out automated emails whenever a repository has hit its maximum quota - much better than discovering that you have an oversized repository a few weeks in and it's too late to do anything about it. 

Reporting on Bitbucket usage

One of the biggest qualms we experience with Bitbucket server is the inability to see what your repository contains from a high-level and visual perspective. However, ScriptRunner provides a reporting feature that lets you do just this within a couple of clicks, including exporting your report to a CSV file for further distribution. For example, the repository size report allows you to see how your repository is split by size and by project using a simple pie chart as shown in the image below.

image2018 7 31 17 42 49

 

Driving DevOps success

DevOps is a term that is often bandied about in our industry, at its core is a fundamental drive to iterate faster with a lean approach to development and release cycles, abolishing long, overdrawn dev practices that, let's admit, we've all experienced as part of a traditional development team. ScriptRunner provides the backbone for your DevOps practices in Bitbucket Server.

As well as ready-made functionality, ScriptRunner allows you to create your own solution. It is up to you, the user, to decide what you want to build and automate. For example, you can connect Bitbucket to an external application such as Slack, whereby using ScriptRunner's REST functionality you can set up automated alerts every time there is a significant commit issue in your pipeline.

Finally - and it's been difficult to choose which ScriptRunner feature to tell you about as there are so many. However, it would be wrong not to mention that you can also edit BitBucket's User Interface (UI) using ScriptRunner. If there is a particular field you want to include in each commit, you can simply add it. 

Get started today!

So there we have it, an overview of ScriptRunner for Bitbucket server in the shortest method possible. We can talk about many more features and functionality, and it would turn this into a thesis. Instead, we encourage you to try it for yourself and share your experience with us.  Our support team is always ready to help, so for endless automation fun, try ScriptRunner for Bitbucket today.

 

 

 


Stay up to date by signing up for monthly Adaptanews