How to import all tickets + attachments from a JIRA instance to another one

Julien Buffet March 3, 2013

Hi,

I want to export a list of tickets from a JIRA instance and import them in another JIRA instance. I have tried saving tickets in a CSV file and importing the CSV fil. It effectively import the tickets but not their attachements. Is there a way to import all tickets + attachments in JIRA.

Regards,

Julien

6 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Mart Sõmermaa December 10, 2015

@Julien73, I created a Python script for importing issues from one JIRA project to another with comments and attachments, see https://github.com/mrts/ask-jiraexport_import_issues_for_jql. Feel free to ask if you are unsure how to use it.

captain1701 January 23, 2017

@Mart Sõmermaa - Hi Matt, great script and it works mostely perfect. ;-) The only issue I have is while adding the attatchment to the new Jira ticket. I always get an error 500 with an empty error text. Do you have any idea what could be the cause here?

captain1701 January 24, 2017

I have identified the issue: The script currently doesn't support special characters like ä or é for attachment file names.

Mart Sõmermaa January 30, 2017

Thanks for the good words and for reporting the issue, Martin!

Please try the fix in this branch and see if if fixes the issue:

https://github.com/mrts/ask-jira/tree/attachment-normalize-filename

Here is the fix for review:

https://github.com/mrts/ask-jira/pull/2/files

Gerald Luzangi February 2, 2017

Hi Mart, I have attempted to use this script to migrate a project from on JIRA instance to another everytime hit the following error:-

(venv) ➜  ask-jira git:(master) ✗ ./ask-jira.py export_import_issues_for_jql 'project=ACT AND issuetype not in subTaskIssueTypes() AND issuetype != Epic'
Traceback (most recent call last):
  File "./ask-jira.py", line 111, in <module>
    _main()
  File "./ask-jira.py", line 71, in _main
    command(jira, args)
  File "./ask-jira.py", line 58, in export_import_issues_for_jql
    exportimportconfig, args.jql)
  File "/Users/gluzangi/DevOps/ops.infra/jira.migrations/ask-jira/lib/export_import.py", line 8, in export_import_issues
    import_jira = JIRA({'server': import_conf.JIRA['server']},
AttributeError: 'module' object has no attribute 'JIRA'

Listing projects and fields is fine - this AttributeError: a module with a missing JIRA attribute appears during the export_import_issues_for_jql command. 

Any ideas/pointers to what is wrong with my execution?

 

Thanks 

Mart Sõmermaa February 3, 2017

Hi Gerald!

Sure thing,

'module' object has no attribute 'JIRA'

means that your exportimportconfig.py is missing JIRA configuration in JIRA variable, it should look like this:

JIRA = {
    "server": "https://example.com/jira/",
    "user": "user",
    "password": "password"
}
... other variables ...

An earlier version of README didn't have information about this and the example configuration file exportimportconfig-sample.py contained a misleading variable name. These issues have now been fixed.

Hope that helps!

Best,
Mart

0 votes
Jessie Colberg January 22, 2018

Does anyone know if this works when transfering data from an old instance of Jira into a brand new one?

 

The old version is 

  • (v6.2.6#6264-sha1:ee76422) 

and the new version is 

  • (v7.2.8#72010-sha1:dc33de3) 
Mart Sõmermaa January 22, 2018

If you need to import attachments and you want to do that with the ask-jira script referred above, then yes, it works with the versions you listed.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 22, 2018

This is a 4-year old thread, your question and/or answers are probably irrelevant.  I'd suggest asking a full question again for a wider audience and a more up-to-date answer

0 votes
Sahidul Islam Shaikh May 4, 2017

Hi Mart,

I am facing below error while running 'export_import_issues_for_jql'.

AttributeError: type object 'PropertyHolder' has no attribute 'labels'

Can you please help me to resolve?

Details of the error:-

D:\jira-python\ask-jira>python ./ask-jira.py export_import_issues_for_jql "project = TMOVE AND issuetype not in subTaskIssueType
) AND issuetype != Epic ORDER BY key ASC"
About to export/import 50 issues
Exporting TMOVE-134 Traceback (most recent call last):
File "./ask-jira.py", line 133, in
_main()
File "./ask-jira.py", line 90, in _main
command(jira, args)
File "./ask-jira.py", line 59, in export_import_issues_for_jql
exportimportconfig, args.jql)
File "D:\jira-python\ask-jira\lib\export_import.py", line 15, in export_import_issues
_make_new_issues(source_jira, target_jira, issues, conf, result, None)
File "D:\jira-python\ask-jira\lib\export_import.py", line 24, in _make_new_issues
fields = _get_new_issue_fields(issue.fields, conf)
File "D:\jira-python\ask-jira\lib\export_import.py", line 66, in _get_new_issue_fields
value = getattr(fields, name)
AttributeError: type object 'PropertyHolder' has no attribute 'labels'

Thanks,

Sahidul

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 22, 2018

This is a four-year old thread, your question and/or answers are probably irrelevant.  I'd suggest asking a full question again for a wider audience and a more up-to-date answer

0 votes
Julien Buffet March 3, 2013

Hi,

Thanks you for all your answers however I still don't have any solution to my problem:

I have tried the project configurator pluggin with the evaluation license but it seems the this licence gives only the ability to upload a file (import) and not to create the export file (export), which is not very helpfull...

I have checked the link to https://confluence.atlassian.com/pages/viewpage.action?pageId=307038033but this is a manual workaround that I can't use. I have more than 500 issues to export from a JIRA instance and re-import them in another instance. I can't manually copy the attached file in a folder and put the hyperlink in the CVS file for more than 500 issues. What I need is actually pretty standard : Importing an exporting all tickets data.

You say that you have custom tools to import/export a list of Issue. Can you please develop more about those tools. I really need to know which tools you are talking about.
- I used the basic export to excel on (Issues/View/Excel (All fields)) to create the csv file.
- I then go to Import & Export / Import external projects / Import projects and issues from a Comma Separated Values (CSV) file into JIRA to import the CSV file.
I have the issue imported but of course as the exported file is a CSV one, it does not import the attachements to the issues.

Regards,

Julien

0 votes
Teck-En
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 3, 2013
Hi julien, you can import attachment through csv file either using http protocol or file protocol. Check out this article and see if it's helpful: https://confluence.atlassian.com/pages/viewpage.action?pageId=307038033
0 votes
Colin Goudie
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.
March 3, 2013

You can use JIRA's export/import project support. BUT, you first need to ensure a lot of configuration matches between the source and destination instances. (Such as workflows, CF's etc..)

We can help out with this as we have custom tools to do this, however, I also did spot this plugin which may help as well.

https://marketplace.atlassian.com/plugins/com.awnaba.projectconfigurator.projectconfigurator

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question