How to delete all project issues efficiently?

Hi,

I have to migrate tasks from another system to Jira, approximately 17000. When testing the migration, it's really painful to clean up, as bulk operations are limited to 1000 at a time. I had that raised to 10000, but bulk operations failed for such an amount. We lowered it to 5000, and lived with that for a while, but then Jira started to fail for 4000, than for 3000, then for 2000 at a time...

I'd need a solution that

a.) Quickly deletes all issues from a Jira project (I don't mind if issue numbering is reset or is continued).

b.) Have the bulk operation run for as many issues as possible at a time. (this is the less preferred solution as it is really slow, but I can live with that)

I'd rather not delete the project itself, as it has a bunch of configuration applied to it (workflow, screen, issue schemes, etc.).

Any ideas?

6 answers

Balint,

If you delete the project then its configurations will not be deleted. To be on safer side keep a copy of it's configurations.

Otherwise you can use JIRA Rest API to delete the issues in bulk. What I do is use a label like "bulk-26Aug16", in case bulk import fails I can quickly find these issues wither by JQL and then delete it either through the UI or REST API.

-Ravi

Delete rather than import, I think you meant.

Use JIRA Command Line Interface (CLI) and something like:

--action runFromIssueList --jql "project = XXX order by key desc" --common "--action deleteIssue --issue @issue@"

I tried

    jira --action runFromIssueList --jql "project = ProjName order by key desc" --common "--action deleteIssue --issue @issue@"

but received this:

Error: Parameter 'action' cannot be declared more than once.
Error: Parameter 'jql' cannot be declared more than once.
Error: Parameter 'common' cannot be declared more than once.

I also found examples here: https://bobswift.atlassian.net/wiki/display/JCLI/Examples

so I tried

    jira --action runFromIssueList --common "--action deleteIssue --issue @issue@" --search 'project = "ProjName"'

that resulted in 

    Error: Unexpected argument: =
    Error: Unexpected argument: ProjName'
    Error: Parameter 'action' cannot be declared more than once.
    Error: Parameter 'common' cannot be declared more than once.
    Error: Parameter 'search' cannot be declared more than once.
    Error: Unexpected argument: =
    Error: Unexpected argument: ProjName'

So it seems to me that the examples simply don't work... sad

My java version is

C:\Jira>java -version
java version "1.8.0_101"

The examples do work. Is that the exact action string you are using with ProjName? I suspect not. Make sure you have not double quoted it. Embedded double quotes need to be escaped. I recommend using project key so quotes are not needed in your JQL. And for other cases, always use single quotes in your JQL so you don't have to worry about escaping double quotes.

Sorry for the delayed answer, the system prevented me from posting too many comments...

The issue was that I incorrectly customized the jira.bat file, putting %* twice in the command line.

The script (and the examples smile) work fine now.

Thanks!

0 votes

You could script it, but it's not going to be faster than bulk-delete.

The easiest way really is "delete project", as that will just churn through all the issues, there's no limit on the number in the project.  If you do delete a project, then there's some points to remember:

  • Deleting a project does NOT delete the schemes, even if they were only for that project.  You could take a screenshot of the schemes the project uses, delete it and then create a new project and tell it to use the old schemes
  • You can NOT reuse a project key, unless you're willing to do database hacks (you can't delete project ABC and then create another one with key ABC)
  • If you do delete projects, as I said, the schemes will be in place, but you will have to check all your custom field contexts.  If they're all global, or done by issue-type, that'll be fine, but if you have a field that had a context of "only show in projects ABC, DEF and GHI", then deleting project ABC will remove that and you'll need to re-add it.

I tend to go with a jira-python script to search for the issues and then delete them one by one. Not very fast, but you can restart it and it doesn't timeout

Having seen the comments I have to add what I meant by efficiency was that I don't have to babysit the deletion process. I don't mind if it runs slow, as long as it runs without user interaction.

JIRA Command Line Interface, although I have not yet decided whether to buy it.

when you say "babysit the deletion process" - does writing a script that uses the REST API meet this requirement?

Yes, any script is OK. The one I got to use is Bob Swift CLI.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,772 views 18 21
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you