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?
Community moderators have prevented the ability to post new answers.
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: https://scriptrunner.adaptavist.com/latest/jira/builtin-scripts.html#_built_in_scripts_hacking_notes
We will be releasing better documentation and a more extensible way of doing this in the next month or two.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.