Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
crossplane render xrandcrossplane render opsilently ignored failures to clean up Function runtimes (containers):StopFunctionRuntimesonly logged vialog.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 asStopFunctionRuntimesand additionally prints a short warning (including the error) tow. Both commands now defer it with kong'sk.Stderr. The exit code is unchanged.StopFunctionRuntimeskeeps its exported signature and behaviour for external callers; both are built on a small unexported helper that returns the error.FunctionAddresses.Stopitself is untouched.Covered by new unit tests for the warning formatting and the nil-runtime case (no Docker required).
Fixes #399
I have:
Run(nix not available locally; ran./nix.sh flake checkto ensure this PR is ready for review.go build ./...,go test ./cmd/crossplane/render/..., andgolangci-lint run ./cmd/crossplane/render/...instead, all clean)Linked a PR or a docs tracking issue to document this change.Addedbackport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.
🤖 Generated with Claude Code