Skip to content

fix(action): persist failure after a returned rollback error - #32871

Open
perfloop-agent wants to merge 2 commits into
helm:mainfrom
perfloop-oss:perfloop-pr-open-ncydfd2jq5
Open

perfloop-agent wants to merge 2 commits into
helm:mainfrom
perfloop-oss:perfloop-pr-open-ncydfd2jq5

Conversation

@perfloop-agent

@perfloop-agent perfloop-agent commented Nov 8, 2026 •

Copy link
Copy Markdown

What this PR does / why we need it:

When performRollback returns an error and the new revision is still pending-rollback, Rollback.Run marks it failed, attempts to record it, and returns the same error. Already-finalized errors retain their existing handling. This persists a failure known to the running client; it does not retry, rerun hooks, bypass the pending check, or rescue revisions already stuck.

Fixes #32867.

Special notes for your reviewer:

A returned hook timeout or watch error does not prove the hook Job stopped. After failure persistence, a later explicit upgrade can start while that Job may still run. Upgrade already persists hook failures through failRelease, introduced in #6011. The fake-client tests do not prove real-hook safety.

Killed clients, partial writes, and concurrent clients (helm/community#354) are out of scope; this change does not attempt them. A failed storage update can still leave the revision pending.

The additional best-effort Secret write runs on these still-pending failure paths, not successful rollbacks. In these measurements, manifest-build failures took about twice as long and pre-hook creation failures about half again as long. That time and allocation cost is accepted to persist the known failure rather than leave a completed operation holding the pending-state lock.

Medians below cover public rollback calls with two stored revisions and populated or template-free charts, using Secret serialization with a fake Kubernetes API, not cluster latency; each sample runs 100 rollback calls. The last column gives the median paired elapsed-time increase and its interval for the same measurements.

Failure (paired samples) ns/op, before → after B/op, before → after allocs/op, before → after Paired time increase, ns/op
Manifest build (13) 2457322 → 4994752 2636446 → 5028060 3645 → 7016 +2584631 (interval +2300233 to +2909329, 13 pairs)
Pre-hook creation (14) 5023147.5 → 7486262.5 5039177.5 → 7424519 7104 → 10436.5 +2528436.5 (interval +2263557 to +2742786, 14 pairs)
Template-free manifest build (14) 2392081.5 → 4892680.5 2603322.5 → 4983842.5 3479.5 → 6845 +2456729.5 (interval +2267513 to +2783408, 14 pairs)
Template-free pre-hook creation (15) 4921194 → 7233122 4997147 → 7371430 6927 → 10247 +2409173 (interval +1848320 to +2927402, 15 pairs)
Precedent and validation

#3828, fixed by #3829 in 2018, described marking a failing rollback failed “as per the intention of the code.” In #7653, technosophos distinguished unsafe recovery of unknown pending states from “finding cases where pending-* is possibly mis-applied as a state, and fixing that.” This is the latter case: the client is still running and knows the rollback failed.

pkg/action/rollback_failure_test.go checks persisted failure status and error propagation after manifest, hook, waiter, update, readiness, and deployed-query failures, then attempts an ordinary client-dry-run upgrade. It also checks previous-revision status semantics.

Go tests for pkg/action, excluding TestPullRun_ChartNotFound, and rollback CLI tests passed. The full pkg/action suite, including TestPullRun_ChartNotFound, passed in a separate run; that test also passed five runs on each revision. Action lint and source-header validation passed.

If applicable:

  • this PR contains user facing changes (the docs needed label should be applied if so)
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

Case and evidence


Made by Perfloop. Human sponsor: Tomás Senart.

@pull-request-size pull-request-size Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 8, 2026
@github-actions github-actions Bot added the v4.x Issues and Pull Requests related to the major version v4 label Nov 8, 2026
@tsenart

tsenart commented Nov 8, 2026

Copy link
Copy Markdown

Hi, I'm Tomás, I build Perfloop. I approved this contribution and will handle review feedback here.

@gjenkins8, I tagged you because this change is in the Rollback.Run error path around performRollback, which you last reworked for server-side apply. It applies the idea of failRelease from #6011 to rollback: when the running client knows the rollback failed, it records the revision as failed instead of leaving it pending-rollback.

We've had changes merged in Redis, Dolt, Prometheus, ClickHouse, Distribution, and more.

If you'd like anything in this patch changed, just let me know and I'll update it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files. v4.x Issues and Pull Requests related to the major version v4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rollback: hook or build failure leaves the new revision stuck in pending-rollback

2 participants