jira-cli
jira-cli copied to clipboard
jira sprint list only shows issues from one board
jira version 1.0.0
For stories/bugs that are in the sprint but are set as Open status, jira sprint list
or jira sprint list --current
doesn't list those Open/Closed/PENDING/IMPLEMENTED/etc... Status, only listing only In Progress.
This shouldn't be the case, if we are performing jira spring list
it should list all spring regardless of its' statuses and if they need to custom search the status a command such as jira sprint list -sOpen
or jira sprint list --status Closed
should be supported instead.
Hi @leopck, jira sprint list
command shows issues regardless of its statuses as long as it is returned by the Jira API. Could you please mention if you are using jira cloud or on-premises installation (with version)?
That's strange... I'm using jira on-premises installation. Currently have Jira sprints with different statuses but jira sprint list
only shows In Progress
@ankitpokhrel I have snip a comparison of the output for your reference.
The image on the left (terminal) is only displaying the In Progress as seen from the ID of the full list on the right hand side which is the Jira website itself.
Do you get all the issues back if you query the API directly?
curl --request GET \
--url 'https://<jira-server>/rest/agile/1.0/sprint/<sprint_id>/issue' \
--user "<email>:$JIRA_API_TOKEN"
You can get sprint id using jira sprint list
.
(Also could you please mention the version of Jira you are using?)
Jira version: v8.20.2#820002-sha1:829506d:prd1phyjdc01
How do I set bearer for the auth because I'm using PAT (Personal Access Token)?
You can use header to pass bearer token.
curl --request GET \
-H "Authorization: Bearer $JIRA_API_TOKEN" \
--url 'https://<jira-server>/rest/agile/1.0/sprint/<sprint_id>/issue'
@ankitpokhrel thanks for the command. I just finished comparing the two output and compared against the website version as well. The RESTful API is able to query all the issues and it's the same as the website output. Image below shows that the website the REST API is the same.
That's strange! Are all these issues in the sprint from same project that you configured?
Yes, I did not change the project. This is all from the same project.
I am not able to reproduce this in my installation so its bit tricky to say what's happening. Could you please check if you get same results as before when using project filter in the Jira API?
curl --request GET \
-H "Authorization: Bearer $JIRA_API_TOKEN" \
--url 'https://<jira-server>/rest/agile/1.0/sprint/<sprint_id>/issue?jql=project=<project_key>'
@ankitpokhrel yes, it's working as well. Image below shows that the output is the same as the previous REST query and same as the website.
@ankitpokhrel I found what's the issue. Running the debug mode, I discovered the REST API that was used. It was using this API:
https://<jira url>/rest/agile/1.0/board/<id>/sprint/<sprint id>/issue
vs https://<jira url>/rest/agile/1.0/sprint/<sprint id>/issue?jql=project=<project-id>
You can see the difference in the output the top command is using https://<jira url>/rest/agile/1.0/board/<id>/sprint/<sprint id>/issue
and the second command is using https://<jira url>/rest/agile/1.0/sprint/<sprint id>/issue?jql=project=<project-id>
I'm not familiar with board/<id>
, I'm assuming this is board ID. What is this board and board ID?
@ankitpokhrel I just checked the board, this board doesn't list all issues from other status because the board only shows To Do, In Progress and Done.
Is it possible to either support pulling from https://<jira-server>/rest/agile/1.0/sprint/<sprint_id>/issue
itself and support a separate command for pulling sprints from a board: https://<jira url>/rest/agile/1.0/board/<id>/sprint/<sprint id>/issue
rather than defaulting to using the boards directly?
One reasoning is that not everyone is using the boards for sprints. And you can replicate this issue as well, try to create an issue and assign that issue into a Sprint and go to the board to make sure that the status doesn't exist on the board before changing to that status. The issue won't show up on the https://<jira url>/rest/agile/1.0/board/<id>/sprint/<sprint id>/issue
.
@ankitpokhrel I tested this by doing a simple workaround
https://github.com/ankitpokhrel/jira-cli/blob/19ce4b4168b7ac6a98a5b0af8526320bde862781/pkg/jira/sprint.go#L97
I changed this line to this after removing board from the query:
path := fmt.Sprintf("/sprint/%d/issue?startAt=%d&maxResults=%d", sprintID, from, limit)
And now it works! It's not the most elegant solution, I would suggest something like jira sprint list --board
for those that only wants to list sprints on a particular board.
Are all these issues in the sprint from same project that you configured?
I meant board
here, sorry! When I first created this feature, I didn't realize that sprint can have tickets from different boards but this is something that needs to be fixed. No one complained about this so far and for my usecase I usually have tickets from same board in the sprint.
I will work on the fix. PRs are welcome in the meantime!
@ankitpokhrel I don't mind pushing a PR on this, though i'm not a golang expert but I can try. What solution do you have in mind for this? Just remove the board
or have it as an argument e.g. jira sprint list --board <board-id>
or just jira sprint list --board
?
Hi @leopck, this has been fixed with #475. You can use --show-all-issues
flag to view issues from all projects. jira issue list
will only show issues from configured project or project selected with -p
option.
Note that the Jira behavior doesn't seem consistent here so you might still get results different than that of the Jira UI.