Hi
Can anyone help me how to configure a post function in a workflow for execute a shell script
Thanks & regards
Naidu . l
Should be possible with help of groovy, look this:
http://stackoverflow.com/questions/30253684/how-do-i-execute-shell-script-from-jenkins-groovy-script-in-the-parameters-optio
To execute a groovy script in postfunction you need the scriptrunner plugin
https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner/cloud/overview
Hi Stefan Arnold
Thanks for your response, but what i am looking is, I have a shell script in my local system and I want to execute it by using JIRA workflow (post function) please guide me how to configure it.
Naidu.l
You cant do this directly from Jira.
As i said, with the JIRA Plugin ScriptRunner you can execute Scripts in the programming languange groovy in a workflow postfunction.
in this groovy script you can then execute a shell script that is on the same system as your JIRA.
For better explanation i have this little shell-script that simply creates a textfile with a message:
#!/bin/bash echo "This is a Jira groovy to shell test" > /var/atlassian/application-data/jira/scripts/test.txt
Now i want to execute this shell script from jira:
First, as already said, i need the "ScriptRunner"-Plugin to be able to execute "Groovy"-Scripts in Postfunctions.
i now have this groovy script:
def sout = new StringBuffer(), serr = new StringBuffer() def proc = 'sh /var/atlassian/application-data/jira/scripts/testscript.sh'.exec$ proc.consumeProcessOutput(sout,serr) proc.waitForOrKill(1000) println sout
And in my workflow i add a postfunction to my transition thats execute the mentioned Groovy-Script:
groovyToShell.png
When i now execute the transition in the workflow it executes the groovy script which executes the shell-script and the textfile in my case is created.
I hope this helps!
we are select the custom script runner option in post-function right ? please help me
Thanks and regards
Naidu
It looks like you're new here. Sign in or register to get started.