-
Notifications
You must be signed in to change notification settings - Fork 23
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
Fix revision incrementation when approving a package in a repo registered with --directory #125
Fix revision incrementation when approving a package in a repo registered with --directory #125
Conversation
- make revision incrementation on rpkg approve work with --directory repos - add new Directory attribute to PackageRevisionKey - and use it when matching PackageRevisions to filter out from the List operation - package approval flow looks for previous copies of the package to determine new latest revision string (e.g. v1 -> v2) - this involves matching the package-for-approval's path attribute against existing packages' packageName attribute - however: - when a repo is registered using --directory to associate it with a subfolder in the upstream Git repo, packageName is deliberately trimmed of the directory attribute if it exists - but the path in the package-for-approval still has the directory part - so no existing packages can match to be counted as previous copies - therefore the revision can never increase beyond "v1" and the v1 tag is overwritten in Git with each new approval - this also results in previous package copies disappearing
- also for packages with slashes in the name
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.
https://github.com/nordix/porch/blob/1ae60b4366b99064404315984cdbd0f4a44810f5/pkg/cache/repository.go#L249 -- There is also a creation of a PackageRevisionKey, which actually looks like a partial copy, but it seems it would need to refer to the directory as well.
The reason the v1 package revision is getting overwritten is because internally the Git porch repo code uses Now, as you have shown in this PR, on the key it resolves this by prepending the directory to the package name on the key here: Line 94 in dca2f6d
Now, this means that when we do a lookup of a package by a package name, we need to use a filter that removes the prepended directory from the package name because the porch/pkg/repository/repository.go Line 151 in dca2f6d
So if we do the following change, everything should be ok:
|
Now, having different package names on packages and in Git strikes me as being dangerous. It would probably be better to have a package name like "dirname.subdirname.subsubdirname.package-name" and just use that everywhere and be consistent. In the current implementation what happens I wonder when we have the same package name in two directories? It might be OK because Porch considers those as two separate "repos" but it seems to me to be very confusing for users and probably should not be allowed. I think fully distinguisned package names would be better. Still the fix above will probably do for now. |
…geRevisionKey - in Git-side CloseDraft method, trim directory path off full package path before listing PackageRevisions - ensuring only the package name will be used when matching PackageRevisions to filter out, whether or not the repo has a directory set nephio-project/nephio#814
/retest |
/approve |
/approve |
@liamfallon See the following comment: Line 57 in b78d785
|
/approve |
Yes, that's how it is today but the question is, should it be like this? Machine generated IDs are fine for internal IDs but they are terrible for user interaction and Porch forces users to use them on CLI etc. @JamesMcDermott We shouldn't hold up your PR on this conversation. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JamesMcDermott, liamfallon, nagygergo 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:
Approvers can indicate their approval by writing |
/retest |
/test presubmit-nephio-go-test |
Fixes #814