JIRA CLI Does Not Work in batch script

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. 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

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.

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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira Service Desk

Wy are we still using email for Service Desk workflows?

...attest to the experience of an urgent approval that gets lost in the boss’s inbox and requires that special “Please Approve” email or text message. In an age where we have distributed teams...

104 views 0 2
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