Should be possible with help of groovy, look this:
To execute a groovy script in postfunction you need the scriptrunner plugin
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:
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!
If you pass the data you want to write to the shell script as a parameter, you can do whatever you want with it.
However, my "fix the actual problem" instincts are screaming here. "I want to write data to a file" is a solution to some problem, but it feels like it's probably a very poor solution.
Could you tell us what this file is for? There is a very strong chance that there is a *much* better way to meet your goal than writing data to a file.
I have create a issue in JIRA with a specific workflow and i give the all details(status, priority,components, label,Affect version, fix-version ) to my issue. Now i want to print those details into a text file using groovy script
I don't have any scripts. i am asking please share some scripts to store the issue details(type,priority, version) into a text file (/opt/text) through my post function configuration (when the state changed to resolved then execute my script and store the issue details into a particular location )
i don't groovy please share some scripts
Apologies , i have only
"This is a Jira groovy to shell test"
def sout =
StringBuffer(), serr =
def proc =
>Why i am do this means I have store the all the binaries at one place by using the versions, this is the way easy to deploy the binaries per a required version numbers
That's a terrible way to "store the binaries", if I understand what that means. In fact, you don't need to do it at all, as all the information is in JIRA.
All you need to do to make your script work is add parameters. In the "def proc" line Stefan gave you, add the text required as a parameter, then in your script start with "echo $1" to see it come out.
suppose , I have to work on feature-1, then i was create a issue(task/bug) in JIRA and give the version detail like 1.0v (under affect version/fix version) right ? now i want to print the version details with in the same workflow is it possible ?
And one thing we have trigger to print the version details if the issue is in resolved state
I'm sorry, that still does not explain it.
Maybe if I knew what you were trying to achieve, I could get more from your explanations - some context often helps. What are you trying to give to the end user? Not how, but what should they see and why?
Could you please give me the context of what you are trying to do. I cannot make head nor tail of your explanations without that context. I don't care that it's an automation, I need to understand why you want to do this so I can understand what you are trying to get out of it.
I have maintain a central repository to store all my binaries with a version number(what i was given in JIRA issue) by manually but,
If we are able to print the issue properties/details then i can pass those value as a parameters to my next process
so i want asking to you is there any approach to print those value.
Thanks and regards
Ok, that's vague and doesn't tell us much more than you had before, but it's getting there. Some more questions
1.binaries means files like .war , ear .class.
2.from build/release team.
4.see JIRA is mainly used for tacking and controlling right, in my case also use for tacking and control .
could please tell me one thing suppose, we have create a issue(task/bug/store)in JIRA then what details we are provide ?
Thanks & regards
Nexus is our binaries storage location why because, suppose we have released many versions(like 1.0,2.0,3.0..............................10.0) customer rise a bug on 5.0 then we can take the binaries(5.0) deploy it and easy to figure-out solution right(Is it environment problem or something else)
And I tried the following script for print the version of issue using post function its woking fine
@BaseScript ContextBaseScript script
Issue issue = getIssueOrDefault("")
def response = issue.getFixVersions()
// create a file
def file = new File('/var/atlassian/application-data/jira/scripts/response.txt');
// save the response to it
file << response
Thanks & regards
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...
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!
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