Skip to content

Move the fn render --save-on-failure options to Kptfile#4411

Merged
efiacor merged 2 commits intokptdev:mainfrom
Nordix:save-on-render-failure-annotation
Feb 25, 2026
Merged

Move the fn render --save-on-failure options to Kptfile#4411
efiacor merged 2 commits intokptdev:mainfrom
Nordix:save-on-render-failure-annotation

Conversation

@aravindtga
Copy link
Contributor

@aravindtga aravindtga commented Feb 24, 2026

Summary

Replace the --save-on-render-failure CLI flag with a Kptfile annotation (kpt.dev/save-on-render-failure: "true"), making save-on-render-failure a package-level declaration rather than an invocation-time option.
This follows the same pattern as kpt.dev/bfs-rendering and makes the behaviour controllable via the Kptfile, which is essential for Porch integration where packages are rendered programmatically without CLI flags.

Part of: nephio-project/nephio#1009

Changes

New Annotation:

kpn fn render cli flag --save-on-render-failure removed and the annotation kpt.dev/save-on-render-failure in the Kptfile is providing the same feature.

Changes

  • pkg/api/kptfile/v1/types.go: Added SaveOnRenderFailureAnnotation constant
  • pkg/lib/runneroptions/runneroptions.go: Removed SaveOnRenderFailure from RunnerOptions
  • commands/fn/render/cmdrender.go: Removed --save-on-render-failure CLI flag
  • internal/util/render/executor.go: Added saveOnRenderFailure field to hydrationContext, read from root Kptfile annotation (same pattern as BFS). Replaced all hctx.runnerOptions.SaveOnRenderFailure references.

File Changes

  • 7 go files with functional changes
  • 3 documentation file changes
  • 48 test file changes

Next Steps:

  • Add render status conditions to Kptfile
  • Add per-function execution results to Kptfile

Signed-off-by: aravind.est <aravindhan.a@est.tech>
Copilot AI review requested due to automatic review settings February 24, 2026 16:13
@netlify
Copy link

netlify bot commented Feb 24, 2026

Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit 1875e0d
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/699ea0a75cb0f500081cc887
😎 Deploy Preview https://deploy-preview-4411--kptdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. area/fn-runtime KRM function runtime labels Feb 24, 2026
@dosubot
Copy link
Contributor

dosubot bot commented Feb 24, 2026

Related Documentation

Checked 15 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

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

Moves the “save partially rendered resources on render failure” behavior from a kpt fn render CLI flag to a package-level Kptfile annotation to support programmatic rendering flows (e.g., Porch).

Changes:

  • Removed --save-on-render-failure flag and the corresponding RunnerOptions/test-runner config plumbing.
  • Added kpt.dev/save-on-render-failure: "true" annotation support (constant + executor behavior).
  • Updated e2e test packages/expectations to declare the behavior via Kptfile annotations.

Reviewed changes

Copilot reviewed 49 out of 55 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/test/runner/runner.go Stops passing --save-on-render-failure from the test harness.
pkg/test/runner/config.go Removes test config knob that previously toggled the CLI flag.
pkg/lib/runneroptions/runneroptions.go Removes SaveOnRenderFailure from runner invocation options.
pkg/api/kptfile/v1/types.go Introduces SaveOnRenderFailureAnnotation constant used by the renderer.
internal/util/render/executor.go Reads save-on-failure behavior from root Kptfile annotation and uses it during hydration/write.
internal/util/render/executor_test.go Minor formatting change in an existing test struct.
commands/fn/render/cmdrender.go Removes the --save-on-render-failure CLI flag.
e2e/testdata/fn-render/save-on-render-failure/dfs-subpkg-validator-fails/Kptfile Declares save-on-failure via Kptfile annotation for this scenario.
e2e/testdata/fn-render/save-on-render-failure/dfs-subpkg-validator-fails/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/dfs-subpkg-validator-fails/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/dfs-subpkg-mutator-fails/Kptfile Declares save-on-failure via Kptfile annotation for this scenario.
e2e/testdata/fn-render/save-on-render-failure/dfs-subpkg-mutator-fails/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/dfs-subpkg-mutator-fails/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/dfs-parent-validator-fails/Kptfile Declares save-on-failure via Kptfile annotation for this scenario.
e2e/testdata/fn-render/save-on-render-failure/dfs-parent-validator-fails/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/dfs-parent-validator-fails/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/dfs-parent-mutator-fails/Kptfile Declares save-on-failure via Kptfile annotation for this scenario.
e2e/testdata/fn-render/save-on-render-failure/dfs-parent-mutator-fails/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/dfs-parent-mutator-fails/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/dfs-parent-and-subpkg-both-fail/Kptfile Declares save-on-failure via Kptfile annotation for this scenario.
e2e/testdata/fn-render/save-on-render-failure/dfs-parent-and-subpkg-both-fail/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/dfs-parent-and-subpkg-both-fail/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/dfs-multiple-subpkgs-one-fails/Kptfile Declares save-on-failure via Kptfile annotation for this scenario.
e2e/testdata/fn-render/save-on-render-failure/dfs-multiple-subpkgs-one-fails/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/dfs-multiple-subpkgs-one-fails/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/dfs-deep-nested-middle-fails/Kptfile Declares save-on-failure via Kptfile annotation for this scenario.
e2e/testdata/fn-render/save-on-render-failure/dfs-deep-nested-middle-fails/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/dfs-deep-nested-middle-fails/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/dfs-basicpipeline/Kptfile Declares save-on-failure via Kptfile annotation for this scenario.
e2e/testdata/fn-render/save-on-render-failure/dfs-basicpipeline/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/dfs-basicpipeline/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/bfs-subpkg-validator-fails/Kptfile Declares save-on-failure via Kptfile annotation for BFS scenario.
e2e/testdata/fn-render/save-on-render-failure/bfs-subpkg-validator-fails/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/bfs-subpkg-validator-fails/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/bfs-subpkg-mutator-fails/Kptfile Declares save-on-failure via Kptfile annotation for BFS scenario.
e2e/testdata/fn-render/save-on-render-failure/bfs-subpkg-mutator-fails/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/bfs-subpkg-mutator-fails/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/bfs-parent-validator-fails/Kptfile Declares save-on-failure via Kptfile annotation for BFS scenario.
e2e/testdata/fn-render/save-on-render-failure/bfs-parent-validator-fails/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/bfs-parent-validator-fails/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/bfs-parent-mutator-fails/Kptfile Declares save-on-failure via Kptfile annotation for BFS scenario.
e2e/testdata/fn-render/save-on-render-failure/bfs-parent-mutator-fails/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/bfs-parent-mutator-fails/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/bfs-parent-and-subpkg-both-fail/Kptfile Declares save-on-failure via Kptfile annotation for BFS scenario.
e2e/testdata/fn-render/save-on-render-failure/bfs-parent-and-subpkg-both-fail/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/bfs-parent-and-subpkg-both-fail/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/bfs-multiple-subpkgs-one-fails/Kptfile Declares save-on-failure via Kptfile annotation for BFS scenario.
e2e/testdata/fn-render/save-on-render-failure/bfs-multiple-subpkgs-one-fails/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/bfs-multiple-subpkgs-one-fails/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/bfs-deep-nested-middle-fails/Kptfile Declares save-on-failure via Kptfile annotation for BFS scenario.
e2e/testdata/fn-render/save-on-render-failure/bfs-deep-nested-middle-fails/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/bfs-deep-nested-middle-fails/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
e2e/testdata/fn-render/save-on-render-failure/bfs-basicpipeline/Kptfile Declares save-on-failure via Kptfile annotation for BFS scenario.
e2e/testdata/fn-render/save-on-render-failure/bfs-basicpipeline/.expected/diff.patch Updates expected patch output to match new behavior/baselines.
e2e/testdata/fn-render/save-on-render-failure/bfs-basicpipeline/.expected/config.yaml Removes saveOnRenderFailure from test config (now in Kptfile).
Comments suppressed due to low confidence (3)

internal/util/render/executor.go:1

  • This silently treats any non-ConditionTrue value (including typos like \"ture\") as disabled, which can make misconfiguration hard to detect. Consider validating the annotation value explicitly and returning a clear error when the annotation is present but not a supported boolean value (mirroring whatever validation policy you want for kpt.dev/bfs-rendering).
    pkg/api/kptfile/v1/types.go:1
  • Both doc comments are attached to the const block rather than the individual constants, which can make GoDoc output less clear when multiple constants share a block. Consider moving each comment to sit directly above its respective constant (or splitting into separate const blocks) so BFSRenderAnnotation and SaveOnRenderFailureAnnotation are documented independently.
    internal/util/render/executor.go:1
  • The control flow for error handling/write behavior now depends on the new kpt.dev/save-on-render-failure annotation. There doesn’t appear to be a unit test covering the annotation-driven toggle (enabled vs disabled) in internal/util/render/executor_test.go; adding one would help prevent regressions independent of e2e fixtures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: aravind.est <aravindhan.a@est.tech>
@dosubot dosubot bot added the lgtm label Feb 25, 2026
@efiacor efiacor merged commit 0576bc9 into kptdev:main Feb 25, 2026
12 of 15 checks passed
@efiacor efiacor deleted the save-on-render-failure-annotation branch February 25, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/fn-runtime KRM function runtime lgtm size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants