dmorfav opened a new pull request, #9376:
URL: https://github.com/apache/devlake/pull/9376

   ### Summary
   
   Fixes the Azure DevOps (`azuredevops_go`) scope picker hiding **all** 
external (GitHub/Bitbucket) repositories of a project when a single service 
connection fails.
   
   `listRemoteRepos` queries every supported service connection of the project 
in parallel through an `errgroup`. Each goroutine returned the error of its 
`GetRemoteRepositories` call, so as soon as one connection failed (expired or 
revoked credentials, missing permissions, a deleted remote...) `g.Wait()` made 
the function return `nil` plus the error, discarding the repositories already 
collected from the healthy connections. `listAzuredevopsRemoteScopes` then 
dropped that error without logging it, so the UI showed no external 
repositories and the logs had no trace of why.
   
   Projects with many service connections are very likely to have at least one 
broken one, which makes external repositories impossible to add from the UI.
   
   This PR:
   
   - logs a warning for a service connection whose repositories cannot be 
listed and skips it, keeping the repositories of the other connections;
   - logs the errors of `listRemoteRepos` and `listAzuredevopsRepos` that 
`listAzuredevopsRemoteScopes` used to ignore;
   - adds `TestListRemoteReposSkipsFailingServiceConnection` (one failing and 
one working service connection). It fails on `main` (error returned, 0 
repositories) and passes with this change.
   
   `go test -race ./plugins/azuredevops_go/api/...` and `go vet` pass locally.
   
   ### Does this close any open issues?
   
   Closes #9370
   
   ### Screenshots
   
   Not applicable (backend change).
   
   ### Other Information
   
   Kept intentionally small. While reading this code I noticed a few other 
things that may deserve separate follow-ups, but I have not verified them 
against a real organization, so they are not part of this PR:
   
   - `slices.Contains(supportedSourceRepositories, v.Type)` is case-sensitive;
   - `GetRemoteRepositories` does not check `res.StatusCode` and does not guard 
against a repeated continuation token;
   - `GetServiceEndpoints`/`GetRemoteRepositories` build the path as 
`orgId/projectId` even when `orgId` is empty (on-premises), unlike 
`GetRepositories`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to