Add SubpackageDir to API to support clone and upgrade of independent subpackages in a PR#974
Add SubpackageDir to API to support clone and upgrade of independent subpackages in a PR#974liamfallon wants to merge 15 commits into
Conversation
✅ Deploy Preview for porch ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR extends the Porch APIs to support targeting an independent subpackage directory during clone/upgrade operations by introducing a SubpackageDir field (v1alpha1 task specs and v1alpha2 source specs), and updates related code/tests to the new v1alpha2 clone source shape.
Changes:
- Add
SubpackageDirto v1alpha1 clone/upgrade task specs and propagate it through conversions/OpenAPI. - Introduce a
PackageCloneSpecwrapper in v1alpha2 and update callers/tests to usespec.source.cloneFrom.cloneFrom. - Update controller/CLI logic and unit/e2e tests to reference the new v1alpha2 clone source structure.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/crd/side_by_side_test.go | Update e2e clone source construction to the new v1alpha2 clone spec wrapper. |
| test/e2e/crd/helpers_test.go | Adjust helper to build v1alpha2 clone sources using PackageCloneSpec. |
| test/e2e/crd/clone_test.go | Update clone e2e tests for the new v1alpha2 clone source structure. |
| pkg/cli/commands/rpkg/upgrade/v1alpha2.go | Update upstream-name detection to read from the new clone spec wrapper. |
| pkg/cli/commands/rpkg/upgrade/v1alpha2_test.go | Update tests to build clone sources via PackageCloneSpec. |
| pkg/cli/commands/rpkg/upgrade/command.go | Add a --subpackage-dir flag and runner field (currently miswired). |
| pkg/cli/commands/rpkg/clone/v1alpha2.go | Update clone command to set spec.source.cloneFrom via PackageCloneSpec. |
| controllers/packagerevisions/pkg/controllers/packagerevision/source.go | Update controller source application logic to use spec.source.cloneFrom.cloneFrom. |
| controllers/packagerevisions/pkg/controllers/packagerevision/source_test.go | Update controller tests for the new v1alpha2 clone source structure. |
| api/porch/v1alpha2/zz_generated.deepcopy.go | Add deepcopy support for PackageCloneSpec and update PackageSource clone field. |
| api/porch/v1alpha2/util.go | Update creation-source detection to check the new clone wrapper field. |
| api/porch/v1alpha2/util_test.go | Update util tests to use PackageCloneSpec. |
| api/porch/v1alpha2/source_types.go | Add PackageCloneSpec and SubpackageDir fields (with tag issues). |
| api/porch/v1alpha2/porch.kpt.dev_packagerevisions.yaml | Update CRD schema to reflect nested clone spec and new subpackage dir fields. |
| api/porch/v1alpha2/packagerevision_types.go | Change PackageSource.cloneFrom type to *PackageCloneSpec (schema shape change). |
| api/porch/v1alpha1/zz_generated.conversion.go | Wire SubpackageDir through v1alpha1 <-> internal conversions. |
| api/porch/v1alpha1/types.go | Add SubpackageDir to v1alpha1 clone/upgrade task specs (with tag issues). |
| api/porch/types.go | Add SubpackageDir to internal clone/upgrade task specs (with tag issues). |
| api/generated/openapi/zz_generated.openapi.go | Expose the new fields in generated OpenAPI (currently includes misspelled key). |
Comments suppressed due to low confidence (1)
controllers/packagerevisions/pkg/controllers/packagerevision/source.go:131
pr.Spec.Source.Clone.CloneFrommay be nil (it isomitempty), and the code dereferences it immediately. This can panic when a PackageRevision is created withsource.cloneFrom: {}(or missingcloneFrominside). Add validation / nil checks and return a clear error whenCloneFromis not set.
func (r *PackageRevisionReconciler) clonePackage(ctx context.Context, pr *porchv1alpha2.PackageRevision) (map[string]string, error) {
cloneFrom := pr.Spec.Source.Clone.CloneFrom
if cloneFrom.UpstreamRef != nil {
return r.cloneFromUpstreamRef(ctx, pr, cloneFrom.UpstreamRef)
}
if cloneFrom.Git != nil {
return r.cloneFromGit(ctx, pr, cloneFrom.Git)
}
return nil, fmt.Errorf("clone source must specify either upstreamRef or git")
5524a78 to
67a7487
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 18 changed files in this pull request and generated 2 comments.
Files not reviewed (2)
- api/porch/v1alpha1/zz_generated.conversion.go: Language not supported
- api/porch/v1alpha2/zz_generated.deepcopy.go: Language not supported
ff45d38 to
6ad0ecf
Compare
33a961e to
a7e6659
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 22 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- api/porch/v1alpha1/zz_generated.conversion.go: Language not supported
- api/porch/v1alpha2/zz_generated.deepcopy.go: Language not supported
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 22 changed files in this pull request and generated 2 comments.
Files not reviewed (2)
- api/porch/v1alpha1/zz_generated.conversion.go: Language not supported
- api/porch/v1alpha2/zz_generated.deepcopy.go: Language not supported
8079aeb to
dc7c72c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 22 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- api/porch/v1alpha1/zz_generated.conversion.go: Language not supported
- api/porch/v1alpha2/zz_generated.deepcopy.go: Language not supported
afb4bb0 to
e6ae265
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 22 changed files in this pull request and generated no new comments.
Files not reviewed (2)
- api/porch/v1alpha1/zz_generated.conversion.go: Language not supported
- api/porch/v1alpha2/zz_generated.deepcopy.go: Language not supported
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
e6ae265 to
50c9952
Compare



Add SubpackageDir to API to support clone and upgrade of independent subpackages in a PR
Description
SubpackageDirfield to the clone and upgrade tasks on the v1alpha1 API and to the Clone and Upgrade source specifications on the v1alpha2 APIRelated Issue(s)
Type of Change
Checklist
AI Disclosure
[ ] I have used AI in the creation of this PR.