Reformat Jira ticket export to include comments in the ticket description and to update attachment URLs to include an authorization key.
Jira provides the ability to import from CSV two different ways:
- External System Import: A more powerful import accessible only to admins and that is potentially too powerful, auto-creating users and custom fields in a way that may not be desired. https://support.atlassian.com/jira-cloud-administration/docs/import-data-from-a-csv-file/
- Import Issues: A more limited import available to all users, but which (contrary to the documentation as of Dec 2021) does not support importing comments natively. This script will append each comment to the ticket description with the author and date so that the data is not lost. https://support.atlassian.com/jira-software-cloud/docs/create-issues-using-the-csv-importer/
The script will process multiple CSV files, looking for each in a folder called
input
in the current working directory and will save the reformatted to a
folder called output
. This is to, for example, export/import each project
separately as its own file.
Since users may now identified in exports by a GUID and not a regular username,
the script will look up the users in an external users file exported and saved
next to the file as users.csv
. See:
https://support.atlassian.com/organization-administration/docs/export-users-from-a-site/
Attachments are updated with the JIRA credentials (set in the JIRA_API_USER_PASS
constant below) to allow them to be side-loaded into the new instance. See:
https://confluence.atlassian.com/cloudkb/importing-attachments-into-jira-cloud-using-csv-external-system-importer-966669960.html
There may also be system users that are not in this file. These can be mapped
manually in the EXTRA_USERS
constant below.