Skip to content

Prevent stopping repo-sync if querying Bitbucket projectKeys returns "fatal" error

Administrator requested to merge iv/fix-non-fatal-errors-stopping-sync into main

Created by: varsanojidan

Fixes #40449 (closed) Currently, when looping through the projectKeys for a BitBucket host, if we encounter a "fatal" error (i.e. unauthorized, forbidden etc...) we stop the repo sync completely. This causes repos to become stale and excluded repos to still show up. Because this is an error related to on projectKey out of several, we shouldn't assume that if we fail on the one projectKey we will fail on all of them. Ideally there wouldn't be any unauthorized projectKeys in the list, but in the case that someone makes a mistake and adds a bad projectKey to the list, or permissions on the projectKey were changed, we don't want to have repo-syncing permanently turned off.

This implementation can be expanded to other codehosts to signify if certain requests for repos should't stop a repo-sync if they fail.

Test plan

Tested locally using a bitbucket ACC that didn't have access to certain projects, added a sourced repo to excluded, repo was excluded now where it was not excluded before this change. Existing tests pass.

Existing tests pass

Merge request reports

Loading