JIRA CLI Does Not Work in batch script

Summer X June 21, 2012

Hi,

I'm using JIRA 4.4.4 and I have downloaded and installed JIRA CLI. It works fine in cmd window for the most part, but I'm having trouble when putting it in a batch script. The batch script stops executing after the first jira command.

For example, temp.bat contains two lines,

jira --action createIssue --project "Test Project" ...etc etc

jira --action progressIssue --issue "TST-39" --step "Investigate"..etc etc

Now run temp.bat. It stops after successfully creating an issue, without continuing on to progress the issue. Executing these two commands seperately by hand in cmd window works fine, but that defeats the purpose of this plug-in.

On a seperate note, I also noticed jira --fixVersions does not work. For example, my project has a version called V1. Doing --fixVersions "V2" will result in an error telling me the project does not contain this version. Doing --fixVersions "V1" returns no error but the fix Version(s) field just does not get populated.

Thank you

2 answers

1 accepted

1 vote
Answer accepted
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 21, 2012
  1. Bat files calling bat files is quirky Windows behavior, here is how to solve it: See http://stackoverflow.com/questions/1103994/how-to-run-multiple-bat-files-within-a-bat-file
  2. However, consider not using a bat file at all, instead run multiple actions via the run action
  3. Regarding fix version setting. I assume you are talking about the updateIssue action
    • You should get an error if V2 is not a defined version, use --autoVersion to have it automatically create V2 if it does not exist if that is what you want
    • JIRA requires that any field you want to update via remote method be on the equivalent UI screen otherwise it ignores your request (with no error :() - verify that the field is editable from the UI screen for the same user that you are using the CLI with. This is almost always the reason for this kind of issue - if you still have problems, open an issue with details
1 vote
Renjith Pillai
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 21, 2012

Have seen the behaviour, I don't know the root cause (may be the return values of the commands). So to make it work, just call cmd /c "jira --action ....." for each command.

Latha March 16, 2014

It worked for me..thanks a lot Renjith :)

David_Marley May 14, 2018

Worked for me too - several years later here, and I was having exact same problem - "cmd /c" did the trick.

Suggest an answer

Log in or Sign up to answer