Scripts for migrating bug reporting from Launchpad to JIRA

About two and a half years ago I wrote about how the MariaDB project moved bug reporting from Launchpad to JIRA. Every now and then I get contacted about how it was done and whether I would be willing to share the tools used for doing it and of course I’ve done that. Especially in one occasion the scripts were even further developed by one company that was in the process of doing exactly the same, i.e. moving bugs from Launchpad to JIRA. Thanks for the enhancements Philip Colmer from Linaro!

In Launchpad there isn’t a readymade tool for exporting bugs and I didn’t find any 3rd party tools for doing it. Launchpad however has an API through which most (if not all) information in Launchpad can be retrieved. Launchpad has made a library available in Python making use of this API.

By using the Launchpad Python API, I wrote a Python script LaunchpadBugs.py that pulls out bug information from Launchpad and creates an XML document for each bug. If the bug includes attachments these are also downloaded and named in a way that they can be connected to the XML.

It would, of course, be nice if the bunch of XML files and attachments that you end up with after running the Python script could be uploaded directly into a JIRA instance. Unfortunately this is not possible, unless it has been added recently, and instead a separate format is needed. According to my investigations, JIRA supports importing information best if it’s in CSV (comma separated values) format. That leads to converting a bunch of XML files to a CSV file. The CSV file can include links to the attachments.

I’ve done quite a lot of C# programming in the past and still had the way of dealing with XML in C# in my head, so I chose to do the XML to CSV conversion in C# in a Windows command line application. You’ll find the application named JiraCSV in the Github repository mentioned below.

The scripts described above have been useful for those that have reached out explicitly asking for a copy of them, but maybe the interest is broader. To initially get to the point where migration was successful it took a lot of trials to correct the data, add missing data, change the XML or CSV structure, and so on to get everything accepted by JIRA. I hope that by now sharing these scripts people will save a significant amount of time. That’s why I’ve decided to put them up on Github so that anyone interested in them can pick them up and make use of them or even improve them further. You can find them at https://github.com/rasmushoj/LP2JIRA.