[closed] Migrate Jira Comments/Attachments to RTC
The question has been closed for the following reason: "The question is answered, right answer was accepted" by valli Dec 30 '14, 4:57 a.m.
Accepted answer
same approach as with csv.
5 other answers
Comments
see
http://bdunagan.com/2011/11/07/migrating-jira-to-bugzilla/
this is what we did
Thanks Sam. I saw this ruby script - just that I have to configure bugzilla,ruby just for this migration.
you do not need bugzilla, just ruby..
you are putting the data in the same format that bugzilla export would do
bugzilla format is 1 file per issue, like excel is one line per issue
I'm pretty sure you can do this with shell scripting too
Currently, we exported CSV from Jira - to import normal attributes.
CSV import of comments is really a pain.. they wrap across line ends, and will completely mess up the csv if you attempt to edit it. the xml format was much better
Comments
the sample ruby script gets ALL tickets from 1 to 1000.. skipping none.
if you have a short non-consecutive list you would have to build some other loop mechanism..
in bash shell script you can use
for x in 1 4 8 99 105
do
curl command using $x as part of filename
done
the list of ticket numbers could be built as a string (somehow) and substituted in the for loop.
sorry I can't help more
Comments
see here http://peggylin.com/2013/11/18/exporting-ticket-comments-attachments-from-jira/
you need a different URL for each attachment in CURL.. and may have to set the datatype (http accept header)
$attachments = $item->attachments->attachment;
if ($attachments) {
foreach($attachments as $attachment) {
// echo 'attachment: ' . print_r($attachment) . "\n";
$attachment_id = $attachment['id'];
$attachment_name = $attachment['name'];
$url = "https://myjirasite.com/jira/secure/attachment/" . $attachment_id . "/" . urlencode($attachment_name) ;
importing attachments into RTC is MUCH more difficult.. we ended up writing our own utilities.
Thanks Sam. The ruby code to get each of the attachments is working - just that the downloaded file content for excel and images - either doesnt open or format is incorrect. Maybe, I have to use different options with curl. %x to take contents and write in a file looks to cause data issue
I think you need to use an accept-header to set the datatype to binary (not text, not json...) you will probably have to set this differently for each attachmrnt request. (jpg, vs pdf, vs excel, vs text,) ... from the name of the attachment in the xml extract
Comments
the RTC comment text field does not support all the same function that the Jira comment does.. so you will have to make some adjustments.
we wrote a java utility to do all the comments and attachments.
Thanks Sam. If possible, Please share the code-snippet for "Comments extraction from XML" and the "HTML Encoding/decoding & other processing-part [to convert comment into RTC-Supported format".
Thanks Sam. If possible, Please share the code-snippet for "Comments extraction from XML" and the "HTML Encoding/decoding & other processing-part [to convert comment into RTC-Supported format".
I am unable to share that code, sorry
this litle shell script command used as part of a command pipeline can remove all the html tags from the content
sed 's/<[^>]*>//g'
that doesn't make the message any better..(loose formatting, etc.. ) but RTC comments aren't HTML format