Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Kayalvizhi Venkatesan February 14, 2018

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

Suggest an answer

Log in or Sign up to answer
1 vote
Alexey Matveev
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.
February 14, 2018

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.

Kayalvizhi Venkatesan February 14, 2018

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.

Alexey Matveev
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.
February 14, 2018

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.

Kayalvizhi Venkatesan February 14, 2018

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

Alexey Matveev
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.
February 14, 2018

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.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 15, 2018

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
Kayalvizhi Venkatesan February 20, 2018

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?

Alexey Matveev
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.
February 20, 2018
Deepak_Murthy May 31, 2019

@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.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 31, 2019

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.

Deepak_Murthy June 3, 2019

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.

0 votes
Edward Greathouse October 22, 2018

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

Edward Greathouse October 22, 2018

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

 https://scriptrunner.adaptavist.com/5.3.6/jira/#_script_roots

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.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 22, 2018

It starts with <jira home>/scripts

TAGS
AUG Leaders

Atlassian Community Events