Hi all,
I have a custom dialog box I created using a scriptrunner web fragment and custom REST endpoint.
On this dialog box I have a button that I would like to fire off a python script that lives on the jira server. I'm not really sure how I could go about doing this.
My initial thought was have the button point to another custom REST endpoint where the the script would be executed. Is this at all possible?
I'm open to feedback and new ideas on how I can go about doing this.
Thank you
You could try something like this:-
import java.io.FileReader
def file = new File('/home/ram/Downloads/test.py')
def command = "python3 ${file.absoluteFile}"
def proc = command.execute()
proc.waitForOrKill(1000)
log.warn "return code: ${ proc.exitValue()}"
log.warn "stderr: ${proc.err.text}"
log.warn "stdout: ${proc.in.text}"
def fileReader = new FileReader("/home/ram/Downloads/readme.txt")
fileReader.readLines().each {
log.warn it
}
I have tested this to execute a very basic python code, i.e. to update a text file using the ScriptRunner console, and it is working.
Below is a screenshot of the configuration and output for your reference:-
You should be able to use a similar approach on the web-fragment.
I hope this helps to answer your question. :)
Thank you and Kind regards,
Ram
Does the solution I provided help to solve your question?
If yes, please accept the answer.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.
Get Certified! ✍️Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.