Modified release_update and release_rollback

pull/2681/head
Aishwarya Thangappa 8 years ago
parent a9c16fc964
commit 3d4361ca1f

@ -72,6 +72,7 @@ type listCmd struct {
failed bool failed bool
namespace string namespace string
superseded bool superseded bool
pending bool
client helm.Interface client helm.Interface
} }
@ -109,6 +110,7 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command {
f.BoolVar(&list.deleting, "deleting", false, "show releases that are currently being deleted") f.BoolVar(&list.deleting, "deleting", false, "show releases that are currently being deleted")
f.BoolVar(&list.deployed, "deployed", false, "show deployed releases. If no other is specified, this will be automatically enabled") f.BoolVar(&list.deployed, "deployed", false, "show deployed releases. If no other is specified, this will be automatically enabled")
f.BoolVar(&list.failed, "failed", false, "show failed releases") f.BoolVar(&list.failed, "failed", false, "show failed releases")
f.BoolVar(&list.pending, "pending", false, "show pending releases")
f.StringVar(&list.namespace, "namespace", "", "show releases within a specific namespace") f.StringVar(&list.namespace, "namespace", "", "show releases within a specific namespace")
// TODO: Do we want this as a feature of 'helm list'? // TODO: Do we want this as a feature of 'helm list'?
@ -173,6 +175,7 @@ func (l *listCmd) statusCodes() []release.Status_Code {
release.Status_DELETED, release.Status_DELETED,
release.Status_DELETING, release.Status_DELETING,
release.Status_FAILED, release.Status_FAILED,
release.Status_PENDING,
} }
} }
status := []release.Status_Code{} status := []release.Status_Code{}
@ -191,6 +194,9 @@ func (l *listCmd) statusCodes() []release.Status_Code {
if l.superseded { if l.superseded {
status = append(status, release.Status_SUPERSEDED) status = append(status, release.Status_SUPERSEDED)
} }
if l.pending {
status = append(status, release.Status_PENDING)
}
// Default case. // Default case.
if len(status) == 0 { if len(status) == 0 {

@ -41,6 +41,12 @@ func (s *ReleaseServer) RollbackRelease(c ctx.Context, req *services.RollbackRel
return nil, err return nil, err
} }
if !req.DryRun {
s.Log("creating rolled back release for %s", req.Name)
if err := s.env.Releases.Create(targetRelease); err != nil {
return nil, err
}
}
s.Log("performing rollback of %s", req.Name) s.Log("performing rollback of %s", req.Name)
res, err := s.performRollback(currentRelease, targetRelease, req) res, err := s.performRollback(currentRelease, targetRelease, req)
if err != nil { if err != nil {
@ -48,8 +54,8 @@ func (s *ReleaseServer) RollbackRelease(c ctx.Context, req *services.RollbackRel
} }
if !req.DryRun { if !req.DryRun {
s.Log("creating rolled back release %s", req.Name) s.Log("updating status for rolled back release for %s", req.Name)
if err := s.env.Releases.Create(targetRelease); err != nil { if err := s.env.Releases.Update(targetRelease); err != nil {
return res, err return res, err
} }
} }
@ -96,7 +102,7 @@ func (s *ReleaseServer) prepareRollback(req *services.RollbackReleaseRequest) (*
FirstDeployed: crls.Info.FirstDeployed, FirstDeployed: crls.Info.FirstDeployed,
LastDeployed: timeconv.Now(), LastDeployed: timeconv.Now(),
Status: &release.Status{ Status: &release.Status{
Code: release.Status_UNKNOWN, Code: release.Status_PENDING,
Notes: prls.Info.Status.Notes, Notes: prls.Info.Status.Notes,
}, },
// Because we lose the reference to rbv elsewhere, we set the // Because we lose the reference to rbv elsewhere, we set the

@ -47,6 +47,13 @@ func (s *ReleaseServer) UpdateRelease(c ctx.Context, req *services.UpdateRelease
return nil, err return nil, err
} }
if !req.DryRun {
s.Log("creating updated release for %s", req.Name)
if err := s.env.Releases.Create(updatedRelease); err != nil {
return nil, err
}
}
s.Log("performing update for %s", req.Name) s.Log("performing update for %s", req.Name)
res, err := s.performUpdate(currentRelease, updatedRelease, req) res, err := s.performUpdate(currentRelease, updatedRelease, req)
if err != nil { if err != nil {
@ -54,8 +61,8 @@ func (s *ReleaseServer) UpdateRelease(c ctx.Context, req *services.UpdateRelease
} }
if !req.DryRun { if !req.DryRun {
s.Log("creating updated release for %s", req.Name) s.Log("updating status for updated release for %s", req.Name)
if err := s.env.Releases.Create(updatedRelease); err != nil { if err := s.env.Releases.Update(updatedRelease); err != nil {
return res, err return res, err
} }
} }
@ -116,7 +123,7 @@ func (s *ReleaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele
Info: &release.Info{ Info: &release.Info{
FirstDeployed: currentRelease.Info.FirstDeployed, FirstDeployed: currentRelease.Info.FirstDeployed,
LastDeployed: ts, LastDeployed: ts,
Status: &release.Status{Code: release.Status_UNKNOWN}, Status: &release.Status{Code: release.Status_PENDING},
Description: "Preparing upgrade", // This should be overwritten later. Description: "Preparing upgrade", // This should be overwritten later.
}, },
Version: revision, Version: revision,

Loading…
Cancel
Save