-
Notifications
You must be signed in to change notification settings - Fork 248
Fix incorrect handling when unfetched packages are deleted from upstream #2230
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
base: main
Are you sure you want to change the base?
Conversation
| func checkPackageTags(pkgPath, ref string, upstreamRepo *gitutil.GitUpstreamRepo) string { | ||
| // Check if we have a ref in the upstream that matches the package-specific | ||
| // reference. If we do, we use that reference. | ||
| ps := strings.Split(pkgPath, "/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The package path provided in the Kptfile is OS agnostic, so we should not use the OS specific filepath package here.
| // Check the diff. If there are local changes, we keep the subpackage. | ||
| // If the package has been deleted from upstream, we only want to delete | ||
| // it from local if it has no changes. | ||
| originUnfetched, err := pkg.IsPackageUnfetched(originPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we doing this check here ? Why can't we make sure that all the 3 sources are fetched when they are initially pulled on to local ?
|
@mortent Is this still needed ? Can we close this and handle this when there are issues faced by customers with this behavior? |
|
@liamfallon to review |
|
kushal.harish.naidu@ericsson.com, this is slose to what you are working on in Porch |
This PR fixes a corner case that is not handled correctly. If the upstream package contains an unfetched subpackage, it will be fetched when the package is cloned (so similar to how
syncworks in old kpt). If this package is later deleted from upstream, it should only be deleted from local if there are no local changes. Currently this doesn't work correctly, since the package in origin will be unfetched and therefore running the diff will always show changes. With this change, the update logic will fetch the full package for origin before doing a diff.Fixes: #2216
Must merge after #2217