Skip to content

Commit d6170ef

Browse files
fix: add rollback support for pending rollback state in Observe function (#171)
1 parent 7a4c1ac commit d6170ef

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

internal/composition/composition.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,12 @@ func (h *handler) Observe(ctx context.Context, mg *unstructured.Unstructured) (c
179179
}, nil
180180
}
181181

182-
if rel.Status == helmconfig.StatusPendingInstall || rel.Status == helmconfig.StatusPendingUpgrade {
182+
if rel.Status == helmconfig.StatusPendingInstall || rel.Status == helmconfig.StatusPendingUpgrade || rel.Status == helmconfig.StatusPendingRollback {
183183
log.Debug("Composition stuck install or upgrade in progress. Rolling back to previous release before re-attempting.")
184184
// Rollback to previous release
185185
rel, err = hc.Rollback(ctx, releaseName, &helmconfig.RollbackConfig{
186-
MaxHistory: helmMaxHistory,
186+
MaxHistory: helmMaxHistory,
187+
ReleaseVersion: rel.Revision,
187188
})
188189
if err != nil {
189190
return controller.ExternalObservation{}, fmt.Errorf("rolling back release: %w", err)

0 commit comments

Comments
 (0)