JIRA import - get attachment URL's

Chris Ryan September 23, 2013

Hey all,

We're migrating from RTC to JIRA. The attachments in RTC can be exported using the RTC API. We can then import into JIRA using the CSV import. Reference: https://confluence.atlassian.com/display/AOD/Importing+Data+from+CSV

Our RTC work items have attachment links in the in-line descriptions. i.e. a URI to where the attachment exists on the server. We need to migrate the URL of the in-line links to JIRA as well.

When we import our work items into JIRA (along with the attachment reference), the URL is as follows: https://jira:8080/secure/attachment/<someNumberHere>/<attachment_file_name>.

The problem we're having now, is that we have no idea what the JIRA-stored URL of the attachments are BEFORE we import. Therefore, we do not have a way to import the in-line descriptions/links.

Any thoughts?

2 answers

1 accepted

1 vote
Answer accepted
Jason Plumhoff
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.
September 23, 2013
When we went from TRAC to JIRA, I dumped the attachments into folders based on the TRAC ticket numbers. After I imported the issues into JIRA, I wrote a Jelly script to attach the files in the folders to the appropriate issues. There might be a better way, but this worked well for a one-shot import.
Chris Ryan September 23, 2013

Thanks for your reply, Jason.

We are able to get the attachments in there, but we're unsure how to migrate the in-line references (i.e. URL's of the attachments) to the new tool.

They're currently in the format of: https://org.jazz/etc..etc..., and if we migrated the text as-is, the references would be lost.

Jason Plumhoff
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.
September 23, 2013

Is the last part of your hyperlink the actual filename of the attachment? If so, wiki markup is your friend.... you would just need to replace the "http" link in your descriptions/comments with a "[^yourfilenamehere]" link. This markup creates a hyperlink to a file attached to the issue.

How you would do a search and replace to fix all your descriptions now that they've been imported is another story. Not sure the best path, but if it were me I'd probably start trying to craft a Groovy script that uses the REST interface to step through and fix each issue with link. Maybe someone else could chime in with a better solution...

Chris Ryan September 23, 2013

I believe our immediate blocker now is the JIRA link of the attachment, post-import.

When we import the attachments, the link to the attachment will be in the format of :

http://jira:8080/secure/attachment/<seemingly_JIRA_generated_attachment_name>/<image_name>.png

i.e.

http://jira:8080/secure/attachment/10109/capture-20130819-1533.png

That "seemingly_JIRA_generated_attachment_name" is the tricky part. We can't change our WI description`s to contain the new link due to the fact that we won`t know the attachment URL`s until we import. And even then, the path isn`t really clear. :(

Jason Plumhoff
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.
September 23, 2013

Chris - That's what I'm trying to tell you. You shouldn't NEED the entire URL. If the file is attached to the issue, using a link like "[^capture-20130819-1533.png]" will resolve correctly. Or if you want to display the image inline (as opposed to just linking to it), use "!^capture-20130819-1533.png!".

Chris Ryan September 23, 2013

Ahh, I see I see. That works for us in almost all cases. Sometimes attachments in one issue are referenced in other issues. At this point, we'd likely accept those as collateral damage as a result of migration.

Thanks many millions for your help Jason.

- Chris

0 votes
Chris Ryan September 23, 2013

Thanks for your reply, Jason.

We are able to get the attachments in there, but we're unsure how to migrate the in-line references (i.e. URL's of the attachments) to the new tool.

They're currently in the format of: https://org.jazz/etc..etc..., and if we migrated the text as-is, the references would be lost.

Suggest an answer

Log in or Sign up to answer