lindell/multi-gitter

empty repository - could not fetch repositories: EOF

HawkSK opened this issue · 4 comments

Describe the bug
The run command fails if a git repo is empty. Exlcuding the repo does not work.

To Reproduce
Steps to reproduce the behavior:

  1. Have a project ACME containing an empty git repo empty-repo
  2. Run multi-gitter run "/usr/bin/env bash ~/some_script.sh" --config=./config.yaml -B "feature/XY-123" -t "foo" -O ACME
    or also with flag -s ACME/empty-repo
    or also with flag --repo-exclude "empty-repo"
  3. See error could not fetch repositories: EOF

Expected behavior
The run command should finish for all non-empty repositories in the organization. Empty repositories could be reported as a warning/error.

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-28T23:43:51+02:00" level=trace msg="http request" host=acme.com request="GET /rest/api/1.0/projects/ACME/repos/empty-repo/branches/default HTTP/1.1\r\nHost: acme.com\r\nUser-Agent: go-bitbucket/1.0.0/go\r\nAuthorization: Bearer <CENSORED>\nContent-Type: application/json\r\nAccept-Encoding: gzip\r\n\r\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 21:43:51 GMT\r\nPragma: no-cache\r\nSet-Cookie: BITBUCKETSESSIONID=s2~<CENSORED>; Max-Age=1209600; Expires=Tue, 11 Jun 2024 21:43:51 GMT; Path=/; Secure; HttpOnly\r\nVary: X-AUSERNAME\r\nVary: X-AUSERID\r\nVary: Cookie\r\nX-Arequestid: *1UKQTY0x<CENSORED>\r\nX-Asessionid: 1h<CENSORED>\r\nX-Auserid: 30<CENSORED>\r\nX-Ausername: hawk\r\nX-Content-Type-Options: nosniff\r\n\r\n" took=51.3166ms
could not fetch repositories: EOF

any updates?

@ryancurrah This seems to be a bitbucket-server specific problem. I'm not able to repro on other platforms. Are you able to take a look?

@lindell I could probably take a look at this after I get bitbucketcloud support done(if no one else grabs it), my team has recently been focusing on bitbucket cloud support but we would like to try this out on bitbucket server as well soon.

Running into the same issue:

TRAC[0006] http request
host=bitbucket.megacorp.local request="GET /rest/api/1.0/projects/FFS/repos/my-empty-repo/branches/default HTTP/1.1
Host: bitbucket.megacorp.local
User-Agent: go-bitbucket/1.0.0/go
Authorization: Bearer <CENSORED>
Content-Type: application/json
Accept-Encoding: gzip"

response="HTTP/1.1 204
Cache-Control: private, no-cache
Cache-Control: no-cache, no-transform
Content-Type: application/json;charset=UTF-8
Date: Tue, 03 Sep 2024 00:10:56 GMT
Pragma: no-cache
Set-Cookie: BITBUCKETSESSIONID=8AB460349757A5CEB2FA7F03D1D01F95; Max-Age=1209600; Expires=Tue, 17 Sep 2024 00:10:56 GMT; Path=/; Secure; HttpOnly
Vary: X-AUSERNAME
Vary: X-AUSERID
Vary: Cookie
X-Arequestid: @1882E6Dx130x15433787x0
X-Asessionid: ni83on
X-Auserid: 13139
X-Ausername: MYACCOUNT
X-Content-Type-Options: nosniff"
took=62.070583ms

could not fetch repositories: EOF

The problem is that defining the repo as repo-exclude: does not help because the list is obtained before any filtering takes place.

I think simply skipping any repo's returning a 204 (No Content) should suffice.