How to bulk clone issues based on a shared component using the Jira CLI app

This article explains how to clone a batch of Jira issues, that are based on a shared component, using the Jira Command Line Interface app. 

Instructions

You can clone issues either to the same project or to a different project.

  • To clone a batch of issues into the same project, use the cloneIssues action command with the jql parameter. The command clones all the Jira tickets based on the JQL results. Thus, if there are two tickets returned by the JQL, both the tickets are cloned. In the following example, if zjcli is the project key and TestComponent is the component name, the command to be given is as follows:

    Clone to the same project
    --action cloneIssues --jql "project = zjcli and component = TestComponent"

    The results are similar to the output given:

    Issue DEMO-605 cloned to DEMO-606.
    Issue DEMO-604 cloned to DEMO-607.
    2 issues cloned.
  • To clone a batch of issues from one project to another project, use the cloneIssues action command. As an example, assume that zjcli and zjiracli are the project keys of two different projects, and, TestComponent is the component name. In order to insure the target project has the component specified in the issues from the source project, add the autoComponent parameter to automatically create a component in the new project if needed.  The command to be given is then as follows:

    Clone to different project
    --action cloneIssues --project "zjcli" --jql "project = zjiracli AND component = TestComponent" --autoComponent

    The results are similar to:

    Component 'TestComponent' with id 11101 added to project STK.
    Issue DEMO-607 cloned to STK-5.
    Issue DEMO-606 cloned to STK-6.
    Issue DEMO-605 cloned to STK-7.
    Issue DEMO-604 cloned to STK-8.
    4 issues cloned to project STK.
  • You must execute the commands from the CLI client location. 
  • It is recommended to test this scenario in a test environment before deploying it in production.