This article explains how to clone an issue that has links to other Jira issues using the Jira CLI app in the cloud Jira Cloud instance.
Instructions
For this scenario, we would need to use the cloneIssue and copyLinks CLI actions to,.
...
- cloneIssue: Create a new issue by copying an existing issue. By default, if the issue is a subtask, it is cloned to the same parent. Specifying the parent parameter will 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 the normal clone link.
- copyLinks: Copy 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:
- .
...
# 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 qweRTYUI05eg8g95fXopqw 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}
Ensure that the issue that needs to be cloned has linked issues and subtasks. The below example shows an issue being cloned within the same project, T1, that has two linked issues T1-1 and DEMO-2.
Execute the below CLI action:
Code Block theme Midnight --action cloneIssue --project "ZJIRACLICLONE" --issue "ZJIRACLICLONE-6" --copyLinks --copyComments --copySubtasks
The result of the above code block is as follows:
Output on the terminal:Code Block theme Midnight title Output on the terminal: --action cloneIssue --project "T1" --issue "T1-6" --copyLinks --copyComments --copySubtasks 1 comments copied to T1-9. 1 subtasks copied as children of T1-8. Issues T1-8 and T1-1 linked with type 'is blocked by'. Issues T1-8 and DEMO-2 linked with type 'relates to'. 2 links copied to T1-8. 1 comments copied to T1-8. Issue T1-6 cloned to T1-8.
Output in Jira:
Make sure that the acli.properties file in the CLI client folder is filled with Cloud details of Jira as shown below:
Code Block theme Midnight title acli.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 qweRTYUI05eg8g95fXopqw 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}
Info |
---|
|