Add DeepCopy generation to all API types#4527
Conversation
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
ac3e481 to
b24fa7b
Compare
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
There was a problem hiding this comment.
Pull request overview
This PR expands DeepCopy support across the kptfile/v1 and fnresult/v1 API types by enabling package-level controller-gen generation, introducing a shared DeepCopy helper for kyaml/fn/framework result types, and updating render status plumbing to store framework.Results directly (removing the bespoke ResultItem mirror types).
Changes:
- Enable package-level
+kubebuilder:object:generate=trueand add/standardizego:generate controller-gen ... objectdirectives for API packages, then check in regeneratedzz_generated.deepcopy.gofiles. - Replace
kptfilev1.PipelineStepResult.Results/ErrorResultsfrom customResultItemslices toframework.Results, and update render executor/test expectations accordingly. - Add
pkg/api/commonDeepCopy utilities (with tests) and manualDeepCopyIntoimplementations for types containingframework.Results.
Reviewed changes
Copilot reviewed 8 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/api/kptfile/v1/zz_generated.deepcopy.go | Regenerated DeepCopy methods for all kptfile/v1 API types. |
| pkg/api/kptfile/v1/types.go | Package-level generation annotation; switch PipelineStepResult to framework.Results; remove ResultItem and related mirror types. |
| pkg/api/kptfile/v1/deepcopy.go | Manual DeepCopyInto for PipelineStepResult to correctly deep copy framework.Results. |
| pkg/api/fnresult/v1/zz_generated.deepcopy.go | New generated DeepCopy stubs for fnresult/v1 (works with manual Result.DeepCopyInto). |
| pkg/api/fnresult/v1/types.go | Package-level generation annotation and go:generate for controller-gen. |
| pkg/api/fnresult/v1/deepcopy.go | Manual DeepCopyInto for Result to deep copy framework.Results. |
| pkg/api/common/deepcopy.go | New shared deepcopy helpers for framework.Result(s) and interface field values. |
| pkg/api/common/deepcopy_test.go | Unit tests covering the new common deepcopy helpers. |
| internal/util/render/executor.go | Store framework.Results directly in PipelineStepResult and filter ErrorResults via framework.Error. |
| internal/util/render/executor_test.go | Update assertions for framework.Severity and remove tests for deleted conversion helper. |
| go.sum | Dependency checksum cleanup (removes unused docker/distribution entries). |
Files not reviewed (2)
- pkg/api/fnresult/v1/zz_generated.deepcopy.go: Language not supported
- pkg/api/kptfile/v1/zz_generated.deepcopy.go: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 9 changed files in this pull request and generated 3 comments.
Files not reviewed (2)
- pkg/api/fnresult/v1/zz_generated.deepcopy.go: Language not supported
- pkg/api/kptfile/v1/zz_generated.deepcopy.go: Language not supported
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
We have only been generating DeepCopy methods for a few select types, but it would be very useful to do so for all of the API types so it can be easily used by consumers (Porch).
Added the appropriate kubebuilder annotation to be on package level for both the main Kptfile types and fnresult types, the
go generatecomments, then ran the generation.Deduplicated
fnresultv1.ResultItem(removed usage offramework.Result).