Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porch API calls should be atomic #834

Open
kispaljr opened this issue Jan 16, 2025 · 0 comments
Open

Porch API calls should be atomic #834

kispaljr opened this issue Jan 16, 2025 · 0 comments
Labels
area/platform area/porch Porch related issues

Comments

@kispaljr
Copy link
Contributor

kispaljr commented Jan 16, 2025

Right now if processing an API call in the apiserver fails somewhere in the middle, then the modifications done before the failure are not rolled back.

For example here: https://github.com/nephio-project/porch/blob/cb1b392069de7711bb29c3524d6fc464e991f82a/pkg/engine/engine.go#L131 :

During PackageRevision creation, if creating the internal PackageRev object fails, the whole operation returns with an error (as it should), but the creation of a new branch already happened in the git repo and it is not rolled back. That will prevent retrying the creation of the PackageRevision, because it will detect a conflict in the workspace name, because of git's state, even though there is no other PackageRevision object exists with a conflicting workspace name.

The example is about the "Create Package Revision" call, but the same is true for other API calls as well.

Proposal: make sure that on error all previous changes are reverted before returning with the error, for all API calls in the porch apiserver.

@kispaljr kispaljr added area/platform area/porch Porch related issues labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform area/porch Porch related issues
Projects
None yet
Development

No branches or pull requests

1 participant