jira-cli
jira-cli copied to clipboard
New Issue is not linked to Epic.
Describe the bug Creating an issue of type "Story" and trying to link that to a parent Epic doesn't seem to work.
- JiraCLI Version:
(Version="v0.3.0", GitCommit="", CommitDate="", GoVersion="go1.17.5", Compiler="gc", Platform="darwin/arm64")
- Are you using Jira cloud or on-premise jira server? Also mention the version for on-premise installation.
Jira Cloud - Classic project
- What operating system are you using? Also mention version.
macOS Big Sur 11.6.2
- What terminal are you using? Also mention version.
iTerm 2 Build 3.4.14
To Reproduce
- Ran the command with the
-Pflag to link to an epic, as specified here. In my casejira issue create -tStory -PMYEPIC-42 [email protected] - Fill in the remaining fields (Summary & Description)
- Story is created with the correct summary and description. It's also assigned to me, but not linked to the Epic as seen in the Story detail
Epic link- It's set toNone.
Expected behavior
Expected the task to be linked to MYEPIC-42.
As an aside, if I set the issue type to Sub-task, it seems to link it to the Epic properly, but the problem is that it doesn't show on the right pane on jira epic view. I tried some other types but none worked.
jira epic view seems to list all issue types linked to an epic but Sub-task.
Hi @hugoamvieira, to confirm you are using next-gen project and not classic right?
Hey @ankitpokhrel - Nope, it's a classic project.
As per the config:
project:
key: <REDACTED>
type: classic
Are you able to set epic using jira epic add? Attaching issue on creation seem to be working fine in my setup (cloud) so I might need some extra details to debug. Is this epic shown when you try to add it from the UI ?
Are you able to set epic using jira epic add?
Yep. Hadn't tried this but it works like a charm - I created a test Story and added it to an Epic and it worked great :)
Is this epic shown when you try to add it from the UI ?
Yep - I can set the epic in Jira's UI just fine.
@hugoamvieira this can only happen if the config doesn't have value for epic.link. Could you please check and confirm that the generated config file has valid value for epic section? Please try regenerating the config with jira init if the value is missing.
@ankitpokhrel Yep - You're correct. epic.link is set to "".
I tried regenerating but it's still not setting anything in there - What should be in that value?
epic.link is a custom field and is populated using /rest/api/2/issue/createmeta endpoint. It would be helpful If you can execute following curl command and see if the API returns Epic Link custom field for your project.
curl --request GET \
--url 'https://<HOST>.atlassian.net/rest/api/2/issue/createmeta?projectKeys=<KEY>&expand=projects.issuetypes.fields' \
--user "<USER>:$JIRA_API_TOKEN" > createmeta.json
In the response:
- we are first looking for
projects.issuetypeswith"name": "Epic"and, - in the
fieldssection of that block there should be a custom field with nameEpic Link
epic.link is value for that custom field eg customfield_10104
Hey @ankitpokhrel - So I found the projects.issuetypes with "name": "Epic", however there's no custom field within it that has name Epic Link.
This custom field is present in other issuetypes though - Here's how it looks like on other issue types:
"customfield_10008": {
"required": false,
"schema": {
"type": "any",
"custom": "com.pyxis.greenhopper.jira:gh-epic-link",
"customId": 10008
},
"name": "Epic Link",
"key": "customfield_10008",
"hasDefaultValue": false,
"operations": [
"set"
]
}
I'm still a bit confused into what goes into epic.link VS epic.name as jira init set epic.name to one of those customfield_XXXXXX, and epic.link to nothing.
Thanks!
@hugoamvieira its strange that the response doesn't have "Epic Link" field for issue type "Epic". Does the issue link on create work if you manually add customfield_10008 to epic.link ?
@ankitpokhrel Actually, yep. I set it up like this:
epic:
name: "customfield_10008"
link: "customfield_10008"
And it ended up working!
Hopefull this helps someone. After running Jira Init, this is how my config looked (after changing project type to classic).
board:
id: 1619
name: <project_name>
type: kanban
epic:
name: customfield_12271
link: ""
installation: Local
issue:
fields:
custom:
...
- name: Epic Link
key: customfield_12270
schema:
datatype: any
...
project:
key: <project_key>
type: classic
...
The epic.name field had a value of customfield_12271 so I tried setting the epic.link to the same customfield_12271. This didnt work and I got the following error:
- customfield_12271: Field 'customfield_12271' cannot be set. It is not on the appropriate screen, or unknown.
I noticed that the issues.fields.custom.Epic Link had a value of customfield_12270. So I updated my config to following and it worked!
epic:
name: customfield_12270
link: customfield_12270
All in all, in order to get my config to work with an on-prem Jira instance, I did the following:
- Changed project type to
classic - Updated Epic link to the value of the custom field Epic Link
- (optional; personal preference) Updated custom fields names to not have spaces:
Epic Link --> epic_link
Hope this helps.
Thank you - this fixed it for me.