Jira CLI -- how to bulk upload attachments?

Hi,

Thanks to tips from Bob in the past, I know how to download all attachments for all issues from a filter... something like this:

./jira.sh --action runFromIssueList --filter delta-migration-test --common "--action runFromAttachmentList --issue @issue@ --common \"--action getAttachment --issue @issue@ --file \"\"target/@issue@/@attachment@\"\" \" "

Which gets me something like:

target/FOOBAR-123/example.txt

target/FOOBAR-1232/example.pdf

target/FOOBAR-1232/another-one.docx

....

Seems like there should be a way do something similar with an upload. Short of having Jira cli connect for each attachment, any tips? I wish I could just swap "getAttachment" with "addAttachment" and call it a day! :)

One other thing -- is there a way to take the output from getAttachmentList, and upload via that? Didn't see any examples for that.

1 answer

1 accepted

For upload, you need a script (or a csv file produced by a similar script) to look through the directory and files for ones that you want as attachments and then some how map them to a corresponding issue id. The script can drive the addAttachment command or produce a csv file with the same information and drive it with runFromCsv.

Great -- thanks -- works like a charm!

@Bryan Karsh1

Hi Bryan,

        Can you please share the command or script that works for you

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

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

2,777 views 18 21
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