Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Need to know the file path (in server level) where the Script runner's Script Field are stored

Hello All,

Am trying to sync two environments using CMJ plugin. Where Scriptrunner related Scripts are not copied over from Source to target. I guess i need to manually move the Scripts, Can you tell where the Script Field scripts are stored in the server? So that I can manually copy over them.

2 answers

If you open Script Console and then choose the File tab then you will see a help text under the Script text line with the path to the scripts.

Thank you Alexey for your reply. From the Script Console, i can see a <jira-home>/scripts/ as the path mentioned. But when i navigate to the server, there are 0 files in that path <jira-home>/scripts.

Are you sure that there must be scripts? In ScriptRunner you can use inline scripts, which are not saved in the file system.

Go to coq items -> add-ons. Then find Built-In Scripts in the vertical menu and run the Script Registry built-in function. Have a look at what is available.

I can see like they are using Inline Scripts.. :( then no way to move them to another server ?

You need to move only configurations right? If so you can move conditions, validators, post functions with add-ons like Project Configurator or Configuration Manager. All other things you should do manually. That is why I try not to use inline scripts. There are more problems with it than gains.

Inline scripts are fine for the odd little thing that you can easily replicate and for developing them, but for proper scripts, I keep the <jira-home>/scripts directory under source control.

Like Deepak_Murthy likes this

Is there a way to change the path of Inline scripts so that the storage location is changed to some standard file system? How to set the path of the script field storage?

@Nic Brough _Adaptavist_ - Thanks for the suggestion to move scripts to load from files instead of inline. I have more than 150 scripts that are inline and have lost all the scripts a couple of time which has prompted me to move them to individual files and use a source control tool such as Gitlab.

I have a question though - Do you push the code manually to Jira server or have an automated CI/CD pipeline?

I am open to any other suggestions as well.

I am curious as to how you "lost" the scripts - that suggests you're hacking the database or deleting them in the UI.

But keeping them in git is a good plan.  How they're deployed depends on the target system.  I'm old enough to remember the days when we did DevOps without calling it that, and the disasters caused by pushing to production without proper checks - I would never automate a push to production without some preparation and human based gates.  Test - yup, automated push when ready, or even when committed so testing can start as early as possible.

I couldn't exactly determine  what caused the loss of scripts. Strangely it was only scripts defined as a Number Field and this is the second time we have lost them. The first was a few months back and we never figured out why.

The only possible explanations could be two actions were performed in order to solve very slow background reindex times.

Our background reindex times have increased to 15+ hours and our Jira 7.3.3 currently handles:

  • 200000+ issues (one project contains 150,000+)
  • 150+ scripted fields (50 of them pull data from 150,000+ issues)
  • 20+ projects
  • Heavy use of post functions
  • 3000+ custom fields
  • Heavy use of rich filter dashboard
  • 32 Gb physical memory (max pool allocated 12 GB)

But happy to say that I have been able to bring down the reindex time to just under 6 hours after fixing the following:

  • All scripts now error our elegantly (many were returning null and was not handled)
  • Deleted issues that were orphans (a few subtasks without parents)
  • Limited scope of all scripted fields to issue types and projects
  • Post functions scripts that were not in the right order (basically they were before issue update instead of after)

But I still think 6 hours is way too high. A lock and reindex takes only 1 hours but only when turning off Script runner else it just locks up.

scriptrunner_scriptfile_location.PNGHi @Alexey Matveev _Appfire_, I don't see a help box that tells me the file path. Please see my screenshot above.

@Alexey Matveev _Appfire_, nevermind! I followed the link you place on Feb 20.

I was able to see that when the Scriptrunner plugin was installed the directory called "scripts" was created under JIRA home. 

Sorry to bother you and thank you for your assistance.

It starts with <jira home>/scripts

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events