Commit 3f1101cd authored by Adam Reese's avatar Adam Reese

fix(tiller): do not create releases for a dry-run

parent ac88aaf2
...@@ -174,8 +174,7 @@ func (s *releaseServer) ListReleases(req *services.ListReleasesRequest, stream s ...@@ -174,8 +174,7 @@ func (s *releaseServer) ListReleases(req *services.ListReleasesRequest, stream s
Total: total, Total: total,
Releases: rels, Releases: rels,
} }
stream.Send(res) return stream.Send(res)
return nil
} }
func filterReleases(filter string, rels []*release.Release) ([]*release.Release, error) { func filterReleases(filter string, rels []*release.Release) ([]*release.Release, error) {
...@@ -281,9 +280,11 @@ func (s *releaseServer) UpdateRelease(c ctx.Context, req *services.UpdateRelease ...@@ -281,9 +280,11 @@ func (s *releaseServer) UpdateRelease(c ctx.Context, req *services.UpdateRelease
return nil, err return nil, err
} }
if !req.DryRun {
if err := s.env.Releases.Create(updatedRelease); err != nil { if err := s.env.Releases.Create(updatedRelease); err != nil {
return nil, err return nil, err
} }
}
return res, nil return res, nil
} }
...@@ -380,6 +381,9 @@ func (s *releaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele ...@@ -380,6 +381,9 @@ func (s *releaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele
} }
func (s *releaseServer) RollbackRelease(c ctx.Context, req *services.RollbackReleaseRequest) (*services.RollbackReleaseResponse, error) { func (s *releaseServer) RollbackRelease(c ctx.Context, req *services.RollbackReleaseRequest) (*services.RollbackReleaseResponse, error) {
if !checkClientVersion(c) {
return nil, errIncompatibleVersion
}
currentRelease, targetRelease, err := s.prepareRollback(req) currentRelease, targetRelease, err := s.prepareRollback(req)
if err != nil { if err != nil {
...@@ -391,9 +395,11 @@ func (s *releaseServer) RollbackRelease(c ctx.Context, req *services.RollbackRel ...@@ -391,9 +395,11 @@ func (s *releaseServer) RollbackRelease(c ctx.Context, req *services.RollbackRel
return nil, err return nil, err
} }
if !req.DryRun {
if err := s.env.Releases.Create(targetRelease); err != nil { if err := s.env.Releases.Create(targetRelease); err != nil {
return nil, err return nil, err
} }
}
return rel, nil return rel, nil
} }
...@@ -438,10 +444,7 @@ func (s *releaseServer) performKubeUpdate(currentRelease, targetRelease *release ...@@ -438,10 +444,7 @@ func (s *releaseServer) performKubeUpdate(currentRelease, targetRelease *release
kubeCli := s.env.KubeClient kubeCli := s.env.KubeClient
current := bytes.NewBufferString(currentRelease.Manifest) current := bytes.NewBufferString(currentRelease.Manifest)
target := bytes.NewBufferString(targetRelease.Manifest) target := bytes.NewBufferString(targetRelease.Manifest)
if err := kubeCli.Update(targetRelease.Namespace, current, target); err != nil { return kubeCli.Update(targetRelease.Namespace, current, target)
return err
}
return nil
} }
// prepareRollback finds the previous release and prepares a new release object with // prepareRollback finds the previous release and prepares a new release object with
......
...@@ -629,7 +629,7 @@ func TestUpdateReleaseNoChanges(t *testing.T) { ...@@ -629,7 +629,7 @@ func TestUpdateReleaseNoChanges(t *testing.T) {
} }
func TestRollbackReleaseNoHooks(t *testing.T) { func TestRollbackReleaseNoHooks(t *testing.T) {
c := context.Background() c := helm.NewContext()
rs := rsFixture() rs := rsFixture()
rel := releaseStub() rel := releaseStub()
rel.Hooks = []*release.Hook{ rel.Hooks = []*release.Hook{
...@@ -665,7 +665,7 @@ func TestRollbackReleaseNoHooks(t *testing.T) { ...@@ -665,7 +665,7 @@ func TestRollbackReleaseNoHooks(t *testing.T) {
} }
func TestRollbackRelease(t *testing.T) { func TestRollbackRelease(t *testing.T) {
c := context.Background() c := helm.NewContext()
rs := rsFixture() rs := rsFixture()
rel := releaseStub() rel := releaseStub()
rs.env.Releases.Create(rel) rs.env.Releases.Create(rel)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment