kpt icon indicating copy to clipboard operation
kpt copied to clipboard

Porch allows duplicate package revisions to be created

Open ChristopherFry opened this issue 2 years ago • 2 comments

Expected behavior

Porch should not allow a package revision to be created that matches the package name and revision of a package revision that already exists. In this scenario, Porch should throw an error and not allow the duplicate package revision to be created.

Actual behavior

Porch allows the duplicate package revision to be created.

Information

Using kpt and Porch on 6e8b94a3.

Steps to reproduce the behavior

The simplest way to reproduce the issue is to create the same package twice using the kpt cli.

> kpt alpha rpkg init new-blueprint --repository=application-blueprints --revision=v1 -n default
application-blueprints-048c553b23ba2733c37c97ea6157e7c25f41f887 created

> kpt alpha rpkg propose application-blueprints-048c553b23ba2733c37c97ea6157e7c25f41f887 -n default
application-blueprints-048c553b23ba2733c37c97ea6157e7c25f41f887 proposed

> kpt alpha rpkg approve application-blueprints-048c553b23ba2733c37c97ea6157e7c25f41f887 -n default
application-blueprints-048c553b23ba2733c37c97ea6157e7c25f41f887 approved

> kubectl get packagerevisions | grep new-blueprint
application-blueprints-b0be4378eb098a4b0e873153ca5485065639852c    new-blueprint                  main       false    Published   application-blueprints
application-blueprints-048c553b23ba2733c37c97ea6157e7c25f41f887    new-blueprint                  v1         true     Published   application-blueprints

> kpt alpha rpkg init new-blueprint --repository=application-blueprints --revision=v1 -n default
application-blueprints-048c553b23ba2733c37c97ea6157e7c25f41f887 created

> kubectl get packagerevisions | grep new-blueprint 
application-blueprints-b0be4378eb098a4b0e873153ca5485065639852c    new-blueprint                  main       false    Published   application-blueprints
application-blueprints-048c553b23ba2733c37c97ea6157e7c25f41f887    new-blueprint                  v1         false    Draft       application-blueprints
application-blueprints-048c553b23ba2733c37c97ea6157e7c25f41f887    new-blueprint                  v1         true     Published   application-blueprints

> kpt alpha rpkg get | grep new-blueprint
application-blueprints-b0be4378eb098a4b0e873153ca5485065639852c    new-blueprint                  main       false    Published   application-blueprints
application-blueprints-048c553b23ba2733c37c97ea6157e7c25f41f887    new-blueprint                  v1         false    Draft       application-blueprints
application-blueprints-048c553b23ba2733c37c97ea6157e7c25f41f887    new-blueprint                  v1         true     Published   application-blueprints

ChristopherFry avatar Aug 11 '22 18:08 ChristopherFry

cc @johnbelamaric @mortent @natasha41575

ChristopherFry avatar Aug 11 '22 18:08 ChristopherFry

Should I even need to include Revision when creating a PackageRevision? Or should Porch figure that out? We don't want people to skip numbers, either.

johnbelamaric avatar Aug 11 '22 18:08 johnbelamaric

@natasha41575 This should be fixed with your recent PRs right?

mortent avatar Nov 15 '22 22:11 mortent

This should be fixed with the changes to how revisions are assigned.

mortent avatar Jan 26 '23 04:01 mortent