Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


This article explains how to clone an issue that has links to other Jira issues using the Jira Command Line Interface (CLI) app in the cloud instanceJira Cloud.

Instructions

For this scenario, use the cloneIssue and  action with the copyLinks CLI actions to,parameter where: 

  • cloneIssue: Create  Creates a new issue by copying an existing issue. By default, if the issue is a subtask, it is cloned to the same parent. Specifying
    Specify the parent parameter will to allow a subtask to be cloned to a different parent. By default, cloned issue is not linked to the original issue. For example, adding '--link Cloners' will add adds the normal clone link.
  • copyLinks: Copy  Copies issue links when cloning an issue.

Make sure that the acli.properties file in the CLI client folder is filled with Cloud details of Jira as shown below:

Code Block
titleacli.properties
# Cloud requires an email address and a corresponding API token from Atlassian.
# Use an existing token or create one at https://id.atlassian.com/manage/api-tokens (requires an Atlassian account login).

credentials       = --user automation@examplegear.com --token qweRTYUI0xxxxxxxxxxXopqw         

cloudSite         = examplegear

myjiracloud       = jiracloud       -s https://${cloudSite}.atlassian.net      ${credentials}

# This defines the default client for actions, choose the most likely used client

default           = ${myjiracloud}

...

For this example, ensure that the issue to be cloned has linked issues and subtasks.

...

Let's clone an issue

...

within the same project,

...

ZJIRACLONE, that has two linked issues

...

ZJIRACLONE-1 and DEMO-2.

...


...

Image Added

Execute the

...

following command:

Code Block
themeMidnight
--action cloneIssue --project "

...

ZJIRACLONE" --issue "

...

ZJIRACLONE-6" --copyLinks --copyComments --copySubtasks

The result of the above code

...

is as follows:

  • Output on the terminal:
Code Block
themeMidnight
titleOutput on the terminal:
--action cloneIssue --project "

...

ZJIRACLONE" --issue "

...

ZJIRACLONE-6" --copyLinks --copyComments --copySubtasks

1 comments copied to 

...

ZJIRACLONE-9. 
1 subtasks copied as children of 

...

ZJIRACLONE-8. 
Issues 

...

ZJIRACLONE-8 and 

...

ZJIRACLONE-1 linked with type 'is blocked by'.
Issues 

...

ZJIRACLONE-8 and DEMO-2 linked with type 'relates to'.
2 links copied to 

...

ZJIRACLONE-8. 
1 comments copied to 

...

ZJIRACLONE-8. 
Issue 

...

ZJIRACLONE-6 cloned to 

...

ZJIRACLONE-8.
  • Output in Jira:

...

  • Image Added
Info
  • This article applies to the Cloud environment. It can also be applied to the Server environment by changing the acli.properties file with appropriate credentials.
  • To use the commands for server, make sure that the acli.propertiesfile is CLI v9.0 and above.
  • It is recommended to test this scenario in a test environment before environment before implementing it in production.