Use scriptrunner to call python script on Jira Server.

mburgess October 20, 2019

I am integrating Jira with another system and want to call a local python script during a close transition on an Jira issue.

How can I invoke the local script using scriptrunner?  The python script is in a local directory on my Jira server. 

Additionally, I'd like to be able to pass an argument(close reason) to the python script, if possible.  Can I do that with scriptrunner? 

1 answer

0 votes
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 21, 2019

A very blunt approach (which will try to run anything you want)

def thingToRun = "Command (including parameters) to run".execute()

thingToRun.waitForOrKill(x)

x being the number of milliseconds to let it run before killing it as a suspected zombie (I think it's milliseconds, been a while since I used it)

Then you can interrogate thingToRun.exitValue() to see what the return code was.

mburgess October 22, 2019

Thanks Nic

 

I can't get this to work at all.... I was wondering if you could help.  I can put the absolute path location on the linux server where Jira server is hosted and it can't find file/folder.  I've also tried to add the file to the JIRA_Home/scripts directory with same result... (and several other areas).

 

So, I would like to pull the offenseID and a custom_field(closing reason) and pass that to the script.

Ben Poulson
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 22, 2019

Could you try running an "ls /absolute/path/to/script" for the directory the script is stored in, and returning the exit value?

Suggest an answer

Log in or Sign up to answer