Skip to content

Gitlab project not found: return a ProjectNotFoundError

Administrator requested to merge mlw-gitlab-cloud-cleanup into main

Created by: mollylogue

Context:

  • We have a background task in Cloud that iterates over all repos associated w/ a cloud_default external service (i.e. only synced on demand) and a non-empty last_error field and calls syncer.SyncRepo() for each of these repos. That SyncRepo function checks here if the error returned is a particular type of error or not. Currently none of the errors returned from Gitlab match that type, so this code updates that code to return the correct error.
  • I personally prefer this method (returning the ProjectNotFoundError rather than an HTTPError) because it's what we do with Github and it seems way cleaner. If others are worried about making this change to the error being returned, there is the possibility of handling an http error returned by RepoStore.GetByName in the syncer instead. I just personally prefer to keep consistency across different sources.

Test plan

Updated/added unit tests to reflect this behavior. Will also test once more in my local deployment before merging.

Closes https://github.com/sourcegraph/security-issues/issues/210

Merge request reports

Loading