Skip to content

fix(render): warn on stderr when function runtimes can't be cleaned up - #402

Draft
jcogilvie wants to merge 1 commit into
crossplane:mainfrom
jcogilvie:jco/render-report-cleanup-failures
Draft

jcogilvie wants to merge 1 commit into
crossplane:mainfrom
jcogilvie:jco/render-report-cleanup-failures

Conversation

@jcogilvie

Copy link
Copy Markdown
Collaborator

Description of your changes

crossplane render xr and crossplane render op silently ignored failures to clean up Function runtimes (containers): StopFunctionRuntimes only logged via log.Info, and the CLI's logger is a no-op without --verbose, so the command exited 0 with no indication anything was left behind.

This adds render.StopFunctionRuntimesAndWarn(w, log, fa), which does the same as StopFunctionRuntimes and additionally prints a short warning (including the error) to w. Both commands now defer it with kong's k.Stderr. The exit code is unchanged. StopFunctionRuntimes keeps its exported signature and behaviour for external callers; both are built on a small unexported helper that returns the error. FunctionAddresses.Stop itself is untouched.

Covered by new unit tests for the warning formatting and the nil-runtime case (no Docker required).

Fixes #399

I have:

  • Read and followed Crossplane's contribution process.
  • Run ./nix.sh flake check to ensure this PR is ready for review. (nix not available locally; ran go build ./..., go test ./cmd/crossplane/render/..., and golangci-lint run ./cmd/crossplane/render/... instead, all clean)
  • Added or updated unit tests.
  • Linked a PR or a docs tracking issue to document this change.
  • Added backport release-x.y labels to auto-backport this PR.

Need help with this checklist? See the cheat sheet.

🤖 Generated with Claude Code

StopFunctionRuntimes only reported cleanup failures via log.Info, and the
CLI's logger is a no-op unless --verbose is set. As a result `crossplane
render xr` and `crossplane render op` silently left Function containers
behind when stopping them failed.

Add StopFunctionRuntimesAndWarn, which behaves like StopFunctionRuntimes
but also writes a short warning (including the error) to the given
writer, and use it with kong's stderr in both commands. The exit code is
unchanged, and StopFunctionRuntimes keeps its existing signature and
behaviour for external callers.

Fixes crossplane#399

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

render: Function cleanup failures are invisible without --verbose

1 participant