Groovy Script question

AKASHB June 6, 2013

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

0 votes
Siddheshwar mhetre
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.
July 22, 2013

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?
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
July 22, 2013

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.

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
June 6, 2013

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

AKASHB June 13, 2013

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

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
June 13, 2013
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"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events