Groovy Script question

I want to write a groovy script that

Connects to dev JIRA.

Then search for issues, which their summaries contains the word "groovy"

If it exists, output the list of issues by issue key and Summary.

Otherwise, create an issue of that Summary: Issue from Groovy. And description ticket from Groovy.

So can any give me some idea or kick start.

2 answers

JIRA Command Line Interface can do most of this automatically and you can drive it from a groovy script if you want.

getIssueList will do the first part with the right JQL query. Then the otherwise part is just: createIssue

Can you please give me some kick start for connecting jira. using groovy script

def cmd = "/sde/atlassian-cli-3.5.0/atlassian jira --action getServerInfo"

def process = cmd.execute()
process.waitFor()

println "return code: ${ process.exitValue()}"
println "stderr: ${process.err.text}"
println "stdout: ${process.in.text}"

The above used the Atlassian Command Line Interface distribution. If you use the JIRA Command Line Interface distribution then replace the command with something like

def cmd = "/sde/jira-cli-3.5.0/jira --action getServerInfo"

Hey Bob, I am using Groovey Script Runner and I have tried above script in my Jira. But it is giving me an error that

"javax.script.ScriptException: java.io.IOException: Cannot run program "/sde/jira-cli-3.5.0/jira": CreateProcess error=3, The system cannot find the path specified"
So what is the solution over that?

The example references a file path on your server. You need to reference the directory on your file server that contains the JCLI distribution that you installed.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

357 views 0 6
Read article

Atlassian User Groups

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!

Find my local user group

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

Groups near you