Repository navigation
Conversation
…mote repositories listRemoteRepos queried every GitHub/Bitbucket service connection of a project in parallel and returned an error as soon as one of them failed, discarding the repositories already collected from the others. listAzuredevopsRemoteScopes then dropped that error silently, so a single broken service connection (e.g. expired credentials) hid every external repository of the project in the scope picker, with nothing in the logs. Log and skip a failing service connection instead, and log the errors that listAzuredevopsRemoteScopes used to ignore. Closes apache#9370
Author
|
Hi! A bit of context on this PR and #9371: we are rolling out Apache DevLake for the first time (v1.0.3-beta19) to track DORA metrics for one of our teams, using Jira, Bitbucket Cloud and Azure DevOps Pipelines, and these are the two issues we ran into along the way.
We kept both fixes as small as possible. If you would prefer a different approach (for example, showing the failing service connections in the UI instead of just logging them), we are happy to adapt. We also can't add the Thanks for the project, it has been very useful so far. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Azure DevOps (
azuredevops_go) scope picker hiding all external (GitHub/Bitbucket) repositories of a project when a single service connection fails.listRemoteReposqueries every supported service connection of the project in parallel through anerrgroup. Each goroutine returned the error of itsGetRemoteRepositoriescall, so as soon as one connection failed (expired or revoked credentials, missing permissions, a deleted remote...)g.Wait()made the function returnnilplus the error, discarding the repositories already collected from the healthy connections.listAzuredevopsRemoteScopesthen 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:
listRemoteReposandlistAzuredevopsReposthatlistAzuredevopsRemoteScopesused to ignore;TestListRemoteReposSkipsFailingServiceConnection(one failing and one working service connection). It fails onmain(error returned, 0 repositories) and passes with this change.go test -race ./plugins/azuredevops_go/api/...andgo vetpass 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;GetRemoteRepositoriesdoes not checkres.StatusCodeand does not guard against a repeated continuation token;GetServiceEndpoints/GetRemoteRepositoriesbuild the path asorgId/projectIdeven whenorgIdis empty (on-premises), unlikeGetRepositories.