repo-updater: Expose unauthorized error during sync
Created by: ryanslade
During sync, if we encounter bad credentials we treat this as a special case where instead of bailing out we continue the sync as if zero repos were sourced. We don't want to treat it as a hard error since then we won't back off and the repos will continue to be associated with the external service.
However, we DO want to record that there was an issue during sync so this change returns an error back to our workerutil handler so that the error is at least recorded against the external service. This in turn allows us to surface the error to the user via the ExternalService.LastSyncError field in our API.
Also note that the error is returned after we've updated the NextSyncAt field so backoff will continue to work.
Merge request reports
Activity
Created by: codecov[bot]
Codecov Report
Merging #16903 (1cb941c) into main (f1a6779) will increase coverage by
0.00%
. The diff coverage is100.00%
.@@ Coverage Diff @@ ## main #16903 +/- ## ======================================= Coverage 52.29% 52.30% ======================================= Files 1699 1699 Lines 84014 84022 +8 Branches 7678 7678 ======================================= + Hits 43937 43944 +7 - Misses 36204 36206 +2 + Partials 3873 3872 -1
Flag Coverage Δ *Carryforward flag go 51.41% <100.00%> (+<0.01%)
integration 29.69% <ø> (ø)
Carriedforward from f1a6779 storybook 28.71% <ø> (ø)
Carriedforward from f1a6779 typescript 54.39% <ø> (ø)
Carriedforward from f1a6779 unit 35.02% <ø> (ø)
Carriedforward from f1a6779 *This pull request uses carry forward flags. Click here to find out more.
Impacted Files Coverage Δ internal/repos/syncer.go 77.40% <100.00%> (+0.47%)
...nal/campaigns/resolvers/changeset_apply_preview.go 58.97% <0.00%> (-0.86%)