GoogleContainerTools / kpt-config-sync

Config Sync - used to sync Git, OCI and Helm charts to your clusters.
Apache License 2.0
243 stars 43 forks source link

chore: SyncStatusClient return status.Errors #1476

Closed karlkfi closed 2 weeks ago

karlkfi commented 2 weeks ago

Returning status.Error instead of just error simplifies usage of the return value, which is usually appended to a MultiError or returned directly to state.invalidate(err). The caller doesn't need to append, if there's no other error that needs to be reported to the RSync status.

This change also fixes SetImageToSyncAnnotation to return APIServer errors, instead of wrapping all errors as Source errors. This is better because most error types from client.Patch are APIServer errors, and we have no explicit interface contract to detect OCI image signature validation errors from a webhook.

google-oss-prow[bot] commented 2 weeks ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nan-yu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/GoogleContainerTools/kpt-config-sync/blob/main/OWNERS)~~ [nan-yu] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment