Merge pull request #5970 from thomastaylor312/fix/missing_wait

fix(pkg/action): Adds back in missing wait functionality
pull/5980/head
Taylor Thomas 6 years ago committed by GitHub
commit 61578de6a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -149,7 +149,7 @@ func (r *Rollback) performRollback(currentRelease, targetRelease *release.Releas
cr := bytes.NewBufferString(currentRelease.Manifest) cr := bytes.NewBufferString(currentRelease.Manifest)
tr := bytes.NewBufferString(targetRelease.Manifest) tr := bytes.NewBufferString(targetRelease.Manifest)
// TODO add wait
if err := r.cfg.KubeClient.Update(cr, tr, r.Force, r.Recreate); err != nil { if err := r.cfg.KubeClient.Update(cr, tr, r.Force, r.Recreate); err != nil {
msg := fmt.Sprintf("Rollback %q failed: %s", targetRelease.Name, err) msg := fmt.Sprintf("Rollback %q failed: %s", targetRelease.Name, err)
r.cfg.Log("warning: %s", msg) r.cfg.Log("warning: %s", msg)
@ -161,6 +161,16 @@ func (r *Rollback) performRollback(currentRelease, targetRelease *release.Releas
return targetRelease, err return targetRelease, err
} }
if r.Wait {
buf := bytes.NewBufferString(targetRelease.Manifest)
if err := r.cfg.KubeClient.Wait(buf, r.Timeout); err != nil {
targetRelease.SetStatus(release.StatusFailed, fmt.Sprintf("Release %q failed: %s", targetRelease.Name, err.Error()))
r.cfg.recordRelease(currentRelease)
r.cfg.recordRelease(targetRelease)
return targetRelease, errors.Wrapf(err, "release %s failed", targetRelease.Name)
}
}
// post-rollback hooks // post-rollback hooks
if !r.DisableHooks { if !r.DisableHooks {
if err := r.execHook(targetRelease.Hooks, hooks.PostRollback); err != nil { if err := r.execHook(targetRelease.Hooks, hooks.PostRollback); err != nil {

@ -211,6 +211,16 @@ func (u *Upgrade) performUpgrade(originalRelease, upgradedRelease *release.Relea
return upgradedRelease, err return upgradedRelease, err
} }
if u.Wait {
buf := bytes.NewBufferString(upgradedRelease.Manifest)
if err := u.cfg.KubeClient.Wait(buf, u.Timeout); err != nil {
upgradedRelease.SetStatus(release.StatusFailed, fmt.Sprintf("Release %q failed: %s", upgradedRelease.Name, err.Error()))
u.cfg.recordRelease(originalRelease)
u.cfg.recordRelease(upgradedRelease)
return upgradedRelease, errors.Wrapf(err, "release %s failed", upgradedRelease.Name)
}
}
// post-upgrade hooks // post-upgrade hooks
if !u.DisableHooks { if !u.DisableHooks {
if err := u.execHook(upgradedRelease.Hooks, hooks.PostUpgrade); err != nil { if err := u.execHook(upgradedRelease.Hooks, hooks.PostUpgrade); err != nil {

Loading…
Cancel
Save