fix: Add stdin support to kpt fn doc for KRM functions expecting input#4352
fix: Add stdin support to kpt fn doc for KRM functions expecting input#4352liamfallon merged 2 commits intokptdev:mainfrom
Conversation
Some KRM functions fail with 'kpt fn doc' because they try to parse input from stdin even when --help flag is provided, resulting in the error: 'failed to parse input bytes: expected exactly one object, got 0' This fix provides an empty ResourceList as stdin when running containers with --help flag, allowing functions that expect input to work properly while still displaying help documentation. Changes: - Add -i and --stdin flags to docker run command - Provide empty ResourceList YAML structure as stdin - Prevents 'expected exactly one object' errors for functions like set-namespace, set-labels, etc. Fixes kptdev#4278 Signed-off-by: pmady <pavan4devops@gmail.com>
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hi @efiacor, thanks for the feedback! You raise a valid point. I considered both approaches: Option 1: Fix individual KRM functions (your suggestion)
Option 2: Fix in
I went with Option 2 because:
That said, I'm happy to close this PR if the team prefers fixing the individual functions instead. Let me know which approach you'd like to proceed with! |
Hey, |
The test was failing in CI environments where Docker/Podman is not running or when the container runtime fails to pull/run images (exit status 125). This change adds runtime availability checks and skips the test gracefully when the container runtime is not available or fails to run the image, preventing false test failures. Signed-off-by: pmady <pavan4devops@gmail.com>
a41bbff to
2e299fe
Compare
|
@efiacor all builds are passing now. |
Some KRM functions fail with 'kpt fn doc' because they try to parse input from stdin even when --help flag is provided, resulting in the error: 'failed to parse input bytes: expected exactly one object, got 0'
This fix provides an empty ResourceList as stdin when running containers with --help flag, allowing functions that expect input to work properly while still displaying help documentation.
Changes:
Fixes #4278