Run or parse remote groovy script

So i had a crazy idea and I was wondering if anyone out there has tried this before I spend more time researching this.

Working with multiple JIRA instances, and they all tend to have some variations of similar scripts, in normal files and in added built-in scripts.  Each JIRA instance is housed on its own VM.

My end goal is to sort of merge all of the common scripts, create more standardized built-ins with a broader range of parameters, indead of having all of these different ''almost the same'' scripts here and there that just get too confusing to know exactly which does which.

One thing I was wondering is if it would be possible to have an actual core folder hosted somewhere with some base classes or even just plain scripts, and be able to just refer to that path on the JIRA instances, so that once a change is done in one it will be changed on all JIRA instances.  I experimented a bit with the GSE class with no success,  Not sure if this is even possible?  Jamie's mentioned a few times that the script needs to be located within the JIRA installation, can I just put a script there that parses the contents of a remote file and runs the script contained there locally?

If there's another way to achieve the same kind of result out there i'm also all ears.  Or course it might just be possible to set up replication for core scripts from a central location, but that's really not that practical for testing/debugging.




2 answers

1 accepted

2 votes
Accepted answer

Not sure from your description, whether you mean you network location. I would suggest to:

  • set-up script root to shared directory using system property (available from SR 3.x), you can have more roots
  • use symbolic links to the same directory

Anyway, there is a problem with inline scripts - they don't have access to classes in script roots, as they are not executed within GSE, but GroovyShell.


Yes, it would be on a different network location on a different VM. I can set up a script root to a location outside of the home directory? That might at least get me partway there.

Just to add to Jozef's answer. You can put them anywhere that is accessible by all your hosts, eg NFS mount. Either sym link that to the home/scripts dir, or set a new script path in system property.

Or, morally the same, have all your scripts in VCS and something that checks them out on all the instances.

Script roots explains how to set the roots in a system property.

I agree with your motivation though, you should consolidate as much as possible. And for bonus points, test.


And another bonus point of VCS deployment - you can them stage easily.

Thank you both for your help!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,425 views 15 19
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you