jira-cli
jira-cli copied to clipboard
`clone` command does not clone custom field values
Describe the bug
As it stands, the jira clone command does not really 'clone' issues in the same way Jira actually would. Issue custom fields are not copied over at all (the custom fields listed in .config/.jira/.config.yml ).
Part of my .config.yml file:
issue:
fields:
custom:
- name: Story Points
key: customfield_10103
schema:
datatype: number
- name: Stakeholders
key: customfield_13875
schema:
datatype: array
items: option
- name: Epic Link
key: customfield_11405
schema:
datatype: any
- name: Sprint
key: customfield_10801
schema:
datatype: array
items: string
- name: Parent Link
key: customfield_13803
schema:
datatype: any
- name: Epic Name
key: customfield_11407
schema:
datatype: string
None of these custom fields are copied over when cloning an issue.
For instance, when cloning issue:
ISSUE-12345
to
ISSUE-12346
The cloned issue does not have custom fields set at all.
Please provide following details
- JiraCLI Version:
(Version="1.1.0", GitCommit="3b93e147eac468ad985bdece27469153b4bb2814", CommitDate="2022-08-14T08:10:40+00:00", GoVersion="go1.18.3", Compiler="gc", Platform="darwin/arm64") - Are you using Jira cloud or on-premise jira server? Also mention the version for on-premise installation.
Jira on-premise, Jira v8.22.6 - What operating system are you using? Also mention version.
macOS Monterey v12.4 - What terminal are you using? Also mention version.
Hyper v3.3.0
To Reproduce
Steps to reproduce the behavior:
- Setup jira-cli as you normally would
- Attempt to clone any issue with custom labels
- Notice that the cloned version of the issue does not have any custom fields set like that in the original issue.
Expected behavior Cloning an issue also clones the values of all custom fields.
Screenshots n/a
Additional context n/a
Hi @coltoneakins, Jira doesn't provide any API to clone the issue. So, the clone command is fetching and re-creating the issue with the most common fields. And, custom fields are not included during this process as this will complicate things a bit. Technically, current clone command is same as issuing the create command by passing all parameters manually.
@ankitpokhrel - Based on your experience, would it be 'infeasible' to adjust the command to:
- Read the custom fields from the source issue then
- Set the custom fields on the newly created, cloned issue
So, it 'seems' like the issue is being cloned?
I haven't worked with Jira's API extensively. So, do you think this approach would work?