Proposal: add --use-source-hooks flag to helm 'rollback'
When rolling back to a previous release, for example B -> A, helm only executes rollback hooks from the target release (A) and ignores any rollback hooks from current release (B). This makes it difficult to undo changes in the context of the current release before rolling back to the previous release.
While the behavior makes sense for helm 'upgrade' (A->B), the behavior is less intuitive for helm 'rollback' (B->A: use hooks in A to undo changes made in B?).
For backwards compatibility, I propose a new flag should be added to helm 'rollback' that lets the user specify from which release hooks should be run for rollback. By default, helm 'rollback' should run hooks from target release, but if the flag (--use-source-hooks) is present, helm 'rollback' should run hooks from the current release.
Code-wise I think main change would only be in rollback.go. A condition could be added that swaps out which release is used in execHook call, based on whether --use-source-hooks flag was used. Please correct me if I'm wrong!
This could also serve as a solution for these issues:
- https://github.com/helm/helm/issues/10233
- https://github.com/helm/helm/issues/5825
- https://github.com/helm/helm/issues/3549
I look forward to your feedback :)
Source: helm/helm