go-jira / jira

simple jira command line client in Go
Apache License 2.0
2.68k stars 328 forks source link

jira hangs and won't respond to Cntl-C , Cntl-Z or Cntl-\ #251

Open wwalker opened 5 years ago

wwalker commented 5 years ago

I never get prompted for a password. and I have to kill the xterm. This is using the custom command:

  - name: sprint-list
    help: display issues for active sprint
    script: |-
      board_id=$({{jira}} req "/rest/agile/1.0/board?projectKeyOrId=$JIRA_PROJECT" --gjq values.0.id)
      {{jira}} req "/rest/agile/1.0/board/$board_id/sprint"

The child process appears to be prompting for a password but the prompt doesn't show up.

Even blindly pasting in the password and hitting enter doesn't recover.

Maybe before running a child jira, the parent should do authentication?

The real issue here is that it breaks the terminal. If I open a new terminal and kill the jira process, the original terminal is still hosed and needs a stty sane

Here's what is output to the terminal:

wwalker@polonium:~$ jira sprint-list -v -v -v
DEBUG Loading Cookies: [atlassian.xsrf.token=B1IZ-UE6Y-QXV1-V604_2e4766c0211dcf44e59b4500d2ff7b038aa81ba6_lout; Path=/; Domain=jira.redacted.com; Expires=Thu, 30 May 2019 20:07:18 GMT; Secure]
DEBUG Request 1: GET /rest/agile/1.0/board?projectKeyOrId=TGOPS HTTP/1.1
Host: jira.redacted.com
User-Agent: Go-http-client/1.1
Cookie: atlassian.xsrf.token=B1IZ-UE6Y-QXV1-V604_2e4766c0211dcf44e59b4500d2ff7b038aa81ba6_lout
Accept-Encoding: gzip

DEBUG Response 1: HTTP/1.1 401 
Cache-Control: no-transform
Connection: keep-alive
Content-Security-Policy: frame-ancestors 'self'
Content-Type: application/xml;charset=UTF-8
Date: Thu, 23 May 2019 20:09:38 GMT
Server: nginx/1.14.0
Vary: User-Agent
Www-Authenticate: OAuth realm="https%3A%2F%2Fjira.redacted.com"
X-Arequestid: 1209x152601x1
X-Asen: SEN-5719037
X-Ausername: anonymous
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>401</status-code><message>Client must be authenticated to access this resource.</message></status>
DEBUG Request 1: GET /rest/auth/1/session HTTP/1.1
Host: jira.threatbuild.com
User-Agent: Go-http-client/1.1
Accept: application/json
Content-Type: application/json
Cookie: atlassian.xsrf.token=B1IZ-UE6Y-QXV1-V604_2e4766c0211dcf44e59b4500d2ff7b038aa81ba6_lout
Accept-Encoding: gzip

DEBUG Response 1: HTTP/1.1 401 
Transfer-Encoding: chunked
Cache-Control: no-cache, no-store, no-transform
Connection: keep-alive
Content-Security-Policy: frame-ancestors 'self'
Content-Type: application/json;charset=UTF-8
Date: Thu, 23 May 2019 20:09:38 GMT
Server: nginx/1.14.0
Vary: User-Agent
Www-Authenticate: OAuth realm="https%3A%2F%2Fjira.threatbuild.com"
X-Arequestid: 1209x152602x1
X-Asen: SEN-5719037
X-Ausername: anonymous
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block

6f
{"errorMessages":["You are not authenticated. Authentication required to perform this operation."],"errors":{}}
0
piotr-piatkowski commented 3 years ago

Yep, I have very the same problem. I have to run pkill jira in separate terminal as it locks with every jira command I have in my script. If I authenticate before running custom command using jira login then later command works fine.