Open svenXY opened 5 years ago
As a quick workaround to get the command to exit with 0, I used:
- name: sprint-add
help: add issue to active sprint for project
args:
- name: ISSUE
required: true
script: |
board_id=$({{jira}} req "/rest/agile/1.0/board?projectKeyOrId=$JIRA_PROJECT" --gjq values.0.id)
sprint_id=$({{jira}} req "/rest/agile/1.0/board/$board_id/sprint?state=active" --gjq values.0.id)
{{jira}} req -M POST "/rest/agile/1.0/sprint/$sprint_id/issue" "{\"issues\":[\"{{args.ISSUE}}\"]}" > /dev/null 2>&1 || true
Where > /dev/null 2>&1 || true
is not a pretty thing to do, but makes it work for now.
I also had to do some ugly stderr redirection to work around this issue...
I had the same issue when deleting an issue link via this resource:
jira req -M DELETE /rest/api/2/issueLink/47286
It shows the program usage, and the message
ERROR Invalid Usage: JSON Parse Error: EOF
However, the command is executed (i.e. the issue link is deleted). The JIRA Rest docs state that there is no available response representation for status 200.
The problem here is how go-jira handles the empty output. I had similar issues in the sprint/moveIssuesToSprint where it returns HTTP status 204 - empty response. The go-jira tries to handle the "" in the json parsers giving the EOF. The command runs successfully, but the client fails to handle its response.
BTW, here is the pr to add the empty response support: https://github.com/go-jira/jira/pull/372
Hi,
I came across #135 and implemented the suggested custom-command. It works down to the last command where it tries to POST the issue/s to be added to the sprint.
It adds the issue to the sprint successfully, but I keep getting 'ERROR Invalid Usage: JSON Parse Error: EOF'.
Running this with curl seems to have worked though:
The problem to me seems to be that no output is returned by this command, thus both templates, -t debug and -t request fail as they require some json to be piped into toJson in the template
Looks like a regression to #72
Is there any easy method to either not spit out the error, or - even better - take the HTTP code and create some output based on the http code
Thanks, Sven