Run or parse remote groovy script

Ubisoft
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.
November 13, 2014

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 http://groovy.codehaus.org/api/groovy/util/GroovyScriptEngine.html 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.

Thanks, 

Eric

 

2 answers

1 accepted

2 votes
Answer accepted
Jozef Kotlár
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.
November 13, 2014

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.

 

Ubisoft
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.
November 14, 2014

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.

1 vote
JamieA
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.
November 14, 2014

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.

 

Jozef Kotlár
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.
November 15, 2014

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

Ubisoft
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.
November 17, 2014

Thank you both for your help!

Suggest an answer

Log in or Sign up to answer