Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Groovy Scripts for Script Runner In-Line or Script File

Amar Parthasarathy October 12, 2018

Hello All,

is there any advantage in creating a groovy script file in the file system vs put it as in-line in Script Runner. Wondering how to following will be affected.

  1. Performance
  2. Jira Cache size
  3. Re-indexing Issues
  4. Database Size

 

4 answers

0 votes
Amar Parthasarathy October 15, 2018

Thanks Steven and Nic. Couldn't agree more on re-usability and source control. 

What about performance, does Jira load the scripts into cache just in time? if that is the case would there be a lag in using as post function lazy loading. 

0 votes
Steven F Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 12, 2018

Buh, sorry I tend to speak-first-and-ask-questions-later -- I didn't mean to come across so negative. At one point I had improperly implemented the Condition interface and scriptrunner unloaded -- Enabling it just kept unloading it. At this point I figured I had to remove it by hand from the DB and I wasn't super pleased with how the storage was done, but I also am aware that it doesn't REALLY matter because they're compiled anyway.

The most important point made in this thread is your last point -- PUT THEM IN SOURCE CONTROL! :)

0 votes
Nic Brough October 12, 2018

Atlassian didn't give Jamie much choice on storage, but we all know it's a bit rubbish.

For dev/test and the odd ad-hoc short script, it will do.  To answer your main question, on all 4 points, it's negligible.  The change in usage between file and db storage is so small, you will struggle to see it.

Personally, I go for file system storage of scripts, so that I can re-use them without copy/paste/remember-to-update-in-many places, but more importantly, I can also put them in source control.

0 votes
Steven F Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 12, 2018

The way the inline source is stored is bad. It stores all items in a string, as a JSON Object, in a JSON Array, in a single cell of the database.

This really hurts if you need to manipulate them without the app online, such as if you create a script that takes down jira/unloads the plugin.

However, since the scripts are compiled and stored on filesystem or inmemory anyway, after initial load I suspect they are identical.

Suggest an answer

Log in or Sign up to answer