From e868da1705f879bd5ec405c5f45601f593b3148a Mon Sep 17 00:00:00 2001 From: Steve Wolter Date: Mon, 17 Sep 2018 21:41:27 +0200 Subject: [PATCH] Check for err before working with newRelease. (#4630) Should fix #4585. Signed-off-by: Steve Wolter --- pkg/tiller/release_update.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index 5cd82dfc5..8f3cc4e8e 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -150,6 +150,8 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( return nil, err } + res := &services.UpdateReleaseResponse{} + newRelease, err := s.prepareRelease(&services.InstallReleaseRequest{ Chart: req.Chart, Values: req.Values, @@ -161,11 +163,6 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( Timeout: req.Timeout, Wait: req.Wait, }) - - // update new release with next revision number so as to append to the old release's history - newRelease.Version = oldRelease.Version + 1 - - res := &services.UpdateReleaseResponse{Release: newRelease} if err != nil { s.Log("failed update prepare step: %s", err) // On dry run, append the manifest contents to a failed release. This is @@ -176,6 +173,10 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( return res, err } + // update new release with next revision number so as to append to the old release's history + newRelease.Version = oldRelease.Version + 1 + res.Release = newRelease + if req.DryRun { s.Log("dry run for %s", newRelease.Name) res.Release.Info.Description = "Dry run complete"