Skip to content

Add DeepCopy generation to all API types#4527

Merged
liamfallon merged 11 commits into
kptdev:mainfrom
nokia:deepcopy-all
May 21, 2026
Merged

Add DeepCopy generation to all API types#4527
liamfallon merged 11 commits into
kptdev:mainfrom
nokia:deepcopy-all

Conversation

@mozesl-nokia
Copy link
Copy Markdown
Contributor

@mozesl-nokia mozesl-nokia commented May 18, 2026

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 generate comments, then ran the generation.

Deduplicated fnresultv1.ResultItem (removed usage of framework.Result).

@netlify
Copy link
Copy Markdown

netlify Bot commented May 18, 2026

Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit 6f2952d
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/6a0ef31c0d600a000860f861
😎 Deploy Preview https://deploy-preview-4527--kptdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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>
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>
Comment thread pkg/api/common/deepcopy.go Outdated
@mozesl-nokia mozesl-nokia marked this pull request as ready for review May 18, 2026 16:44
Copilot AI review requested due to automatic review settings May 18, 2026 16:44
@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. go Pull requests that update Go code labels May 18, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=true and add/standardize go:generate controller-gen ... object directives for API packages, then check in regenerated zz_generated.deepcopy.go files.
  • Replace kptfilev1.PipelineStepResult.Results/ErrorResults from custom ResultItem slices to framework.Results, and update render executor/test expectations accordingly.
  • Add pkg/api/common DeepCopy utilities (with tests) and manual DeepCopyInto implementations for types containing framework.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.

Comment thread pkg/api/common/deepcopy.go Outdated
Comment thread pkg/api/common/deepcopy.go Outdated
Comment thread pkg/lib/kptops/render_executor.go
Comment thread pkg/api/kptfile/v1/types.go Outdated
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread pkg/fn/runtime/runner.go Outdated
Comment thread pkg/fn/runtime/runner.go
Comment thread pkg/api/fnresult/v1/types.go Outdated
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>
@dosubot dosubot Bot added the lgtm label May 21, 2026
@liamfallon liamfallon merged commit 48268fc into kptdev:main May 21, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update Go code lgtm size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants