Report teardown-only failures through the exit status and the log - #100
Merged
Conversation
A cleanup job that cannot report its own failure is worse than no cleanup job. --teardown-only returned nil unconditionally, so a broken teardown step or a node that would not come down exited 0 and CI moved on with resources still allocated. Its three error messages were also written with fmt.Printf straight to stdout rather than through the formatter that --log wraps, so a -l file contained the task lines and none of the errors — the documented workaround was to pipe the console through tee and grep it, and even that recipe was wrong: a trailing `grep ... && exit 1` fails the job precisely when cleanup succeeds. Failures are now collected as the run proceeds, printed through the formatter, and summarized in an error that sets the exit status. Best-effort behaviour is unchanged: every teardown step, node, and platform is still attempted after an earlier failure, since leaving resources behind is worse than a partial teardown. The CI recipe in the documentation collapses to running the command.
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.
Stacked on #99.
The problem
A cleanup job that cannot report its own failure is worse than no cleanup job. Two independent defects made
--teardown-onlyexactly that:nilunconditionally. A broken teardown step, or a node that would not come down, exited 0 and CI moved on with resources still allocated.fmt.Printfstraight to stdout rather than through the formatter--logwraps, so a-lfile contained the task lines and none of the errors.The documented workaround was to pipe the console through
teeand grep it — and that recipe was itself wrong, since a trailinggrep … && exit 1as a script's last line fails the job precisely when cleanup succeeded.The fix
Failures are collected as the run proceeds, printed through the formatter, and summarized in an error that sets the exit status:
Best-effort behaviour is deliberately unchanged — every teardown step, node, and platform is still attempted after an earlier failure, because leaving resources behind is worse than a partial teardown. Only the reporting changed.
Verified end to end:
-lcaptures the errorand the later steps still ran in the failing case.
The CI recipe collapses
dart -c suite.yaml --teardown-only # non-zero if any cleanup failedNo
tee, no grep, no exit-status normalisation. The docs section that explained the scraping workaround is replaced by that one line.Verification
New controller tests assert the failing case exits non-zero, that cleanup still continues past the failure (both the later step and node teardown run), and that the errors reach the formatter rather than raw stdout — plus that a clean run still exits 0 and prints no errors. The test formatter now records
PrintErrorcalls, which is what makes the second assertion possible.go build,go vet,gofmt, and the full suite are green; the docs site builds.