Provisioning: Gracefully handle AlreadyExists errors (#102758)
* Provisioning: Gracefully handle AlreadyExists errors When this occurs, the job is already in the store. The vast majority of use-cases (which currently is all of them!) will be fine with just accepting that as an OK. * chore: make update-workspace * fix: return error, but expect it in tests
This commit is contained in:
@@ -371,6 +371,10 @@ func (rc *RepositoryController) addSyncJob(ctx context.Context, obj *provisionin
|
||||
Pull: syncOptions,
|
||||
},
|
||||
})
|
||||
if apierrors.IsAlreadyExists(err) {
|
||||
logging.FromContext(ctx).Info("sync job already exists, nothing triggered")
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
// FIXME: should we update the status of the repository if we fail to add the job?
|
||||
return fmt.Errorf("error adding sync job: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user