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

Fix revision incrementation when approving a package in a repo registered with --directory #125

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JamesMcDermott
Copy link
Contributor

@JamesMcDermott JamesMcDermott commented Oct 18, 2024

Fixes #814

  • 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 copied suite_utils testing improvements from Add session-conflict resolution for concurrent CUD operations on package revisions #118

- 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
Copy link
Contributor

nephio-prow bot commented Oct 18, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: JamesMcDermott
Once this PR has been reviewed and has the lgtm label, please assign tliron for approval by writing /assign @tliron in a comment. For more information see the Kubernetes Code Review Process.

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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

@nagygergo nagygergo left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Porch packageRevision is not auto-incremented in case the Repository points at a directory
2 participants