It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

ScriptRunner how to add additional 'built-in scripts'?

Robert Obuch Aug 17, 2016

I have a script which I normally paste in to ScriptRunner Script Console but I would like this script to be made available to all system administrators and need to understand how to share this script under the 'Built-in Scripts' section or similar?

1 answer

1 accepted

3 votes
Answer accepted
Adam Markham [Adaptavist] Community Leader Aug 17, 2016

The script should be under the package, and in the corresponding directory under your script root.

So for example at the start of your script you would have:

package com.onresolve.scriptrunner.canned.bitbucket.admin

Which would be under <script-root>/com/onresolve/scriptrunner/canned/bitbucket/admin/MyScript.groovy

Your class in the MyScript.groovy needs to implement the com.onresolve.scriptrunner.canned.CannedScript interface to be picked up by ScriptRunner.

You can find these if you unzip the plugin JAR and find com.onresolve.scriptrunner.canned.bitbucket.admin.CloneRepo.groovy that should give you an example of how these are put together.

The documentation is a little sparse around this unfortunately.

You can similarly do this to find out how to add pre-recieve hooks etc that are picked up automatically by ScriptRunner. Using a similar approach to above and adding to your script roots, its just the package name that will be different.

Although this is JIRA specific further information on built-in scripts can be found here and most of it applies for Bitbucket:

JamieA Aug 29, 2016

We will be releasing better documentation and a more extensible way of doing this in the next month or two.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Here’s what we’re doing to make Jira Cloud faster

Hello Community 🤗 I’m Nikhil, a Product Manager on the Jira Cloud team working on performance improvements. Performance is an ongoing journey and we continue to invest heavily in it. We under...

132 views 1 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you