lindell / multi-gitter

Update multiple repositories in with one command
Apache License 2.0
866 stars 64 forks source link

multi-gitter close: unable to delete branch with bitbucket_server #482

Open HawkSK opened 4 months ago

HawkSK commented 4 months ago

Describe the bug I successfully created a PR with multi-gitter, but when I wanted to close it, the branch was not deleted. PR was deleted successfully.

To Reproduce Steps to reproduce the behavior:

  1. Have a PR from branch feature/XY-123 in repo testrepo in project ACME
  2. Run multi-gitter close --config=./config.yaml -B "feature/XY-123" -R ACME/testrepo
  3. See error

Expected behavior The branch is deleted after the PR is closed/deleted.

Additional context config.yaml

base-url: https://acme.com/
git-type: cmd
platform: bitbucket_server
ssh-auth: true

token: XY-...
username: hawk@acme.com

log-level: trace

Output:

...
time="2024-05-28T22:54:00+02:00" level=info msg="Closing 1 pull requests"
time="2024-05-28T22:54:00+02:00" level=info msg=Closing pr="ACME/testrepo#24"
time="2024-05-28T22:54:00+02:00" level=trace msg="http request" host=acme.com request="DELETE /rest/api/1.0/projects/ACME/repos/testrepo/pull-requests/24 HTTP/1.1\r\nHost: acme.com\r\nUser-Agent: go-bitbucket/1.0.0/go\r\nContent-Length: 14\r\nAuthorization: Bearer <CENSORED>\nContent-Type: application/json\r\nAccept-Encoding: gzip\r\n\r\n{\"version\":0}\n" response="HTTP/1.1 204 \r\nCache-Control: private, no-cache\r\nCache-Control: no-cache, no-transform\r\nContent-Type: application/json;charset=UTF-8\r\nDate: Tue, 28 May 2024 20:54:00 GMT\r\nPragma: no-cache\r\nSet-Cookie: BITBUCKETSESSIONID=s1~CENSORED; Max-Age=1209600; Expires=Tue, 11 Jun 2024 20:54:00 GMT; Path=/; Secure; HttpOnly\r\nVary: X-AUSERNAME\r\nVary: X-AUSERID\r\nVary: Cookie\r\nX-Arequestid: *XBOIK3x<CENSORED>\r\nX-Asessionid: a71cv7\r\nX-Auserid: 123\r\nX-Ausername: HAWK\r\nX-Content-Type-Options: nosniff\r\n\r\n" took=154.1911ms
time="2024-05-28T22:54:00+02:00" level=trace msg="http request" host=acme.com request="DELETE /rest/branch-utils/1.0/projects/ACME/repos/testrepo/branches HTTP/1.1\r\nHost: acme.com\r\nUser-Agent: Go-http-client/1.1\r\nContent-Length: 81\r\nAuthorization: Basic <CENSORED>\nContent-Type: application/json\r\nAccept-Encoding: gzip\r\n\r\n{\"name\":\"refs/heads/feature/XY-123\",\"dryRun\":false}" response="HTTP/1.1 401 \r\nTransfer-Encoding: chunked\r\nCache-Control: private\r\nContent-Type: application/json;charset=UTF-8\r\nDate: Tue, 28 May 2024 20:54:00 GMT\r\nVary: accept-encoding\r\nWww-Authenticate: Basic realm=\"Atlassian Bitbucket\"\r\nX-Arequestid: *1UKQTY0x<CENSORED>\r\n\r\nc5\r\n{\"errors\":[{\"context\":null,\"message\":\"Authentication failed. Please check your credentials and try again.\",\"exceptionName\":\"com.atlassian.bitbucket.auth.IncorrectPasswordAuthenticationException\"}]}\r\n0\r\n\r\n" took=89.2231ms
Error: unable to delete branch: status code 401: {"errors":[{"context":null,"message":"Authentication failed. Please check your credentials and try again.","exceptionName":"com.atlassian.bitbucket.auth.IncorrectPasswordAuthenticationException"}]}
Usage:
...
lindell commented 4 months ago

@ryancurrah Are you able to take a look at this? I have no access bbs to debug this.