Commit 3d4361ca authored by Aishwarya Thangappa's avatar Aishwarya Thangappa

Modified release_update and release_rollback

parent a9c16fc9
......@@ -72,6 +72,7 @@ type listCmd struct {
failed bool
namespace string
superseded bool
pending bool
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.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.pending, "pending", false, "show pending releases")
f.StringVar(&list.namespace, "namespace", "", "show releases within a specific namespace")
// 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_DELETING,
release.Status_FAILED,
release.Status_PENDING,
}
}
status := []release.Status_Code{}
......@@ -191,6 +194,9 @@ func (l *listCmd) statusCodes() []release.Status_Code {
if l.superseded {
status = append(status, release.Status_SUPERSEDED)
}
if l.pending {
status = append(status, release.Status_PENDING)
}
// Default case.
if len(status) == 0 {
......
......@@ -41,6 +41,12 @@ func (s *ReleaseServer) RollbackRelease(c ctx.Context, req *services.RollbackRel
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)
res, err := s.performRollback(currentRelease, targetRelease, req)
if err != nil {
......@@ -48,8 +54,8 @@ func (s *ReleaseServer) RollbackRelease(c ctx.Context, req *services.RollbackRel
}
if !req.DryRun {
s.Log("creating rolled back release %s", req.Name)
if err := s.env.Releases.Create(targetRelease); err != nil {
s.Log("updating status for rolled back release for %s", req.Name)
if err := s.env.Releases.Update(targetRelease); err != nil {
return res, err
}
}
......@@ -96,7 +102,7 @@ func (s *ReleaseServer) prepareRollback(req *services.RollbackReleaseRequest) (*
FirstDeployed: crls.Info.FirstDeployed,
LastDeployed: timeconv.Now(),
Status: &release.Status{
Code: release.Status_UNKNOWN,
Code: release.Status_PENDING,
Notes: prls.Info.Status.Notes,
},
// 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
}
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)
res, err := s.performUpdate(currentRelease, updatedRelease, req)
if err != nil {
......@@ -54,8 +61,8 @@ func (s *ReleaseServer) UpdateRelease(c ctx.Context, req *services.UpdateRelease
}
if !req.DryRun {
s.Log("creating updated release for %s", req.Name)
if err := s.env.Releases.Create(updatedRelease); err != nil {
s.Log("updating status for updated release for %s", req.Name)
if err := s.env.Releases.Update(updatedRelease); err != nil {
return res, err
}
}
......@@ -116,7 +123,7 @@ func (s *ReleaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele
Info: &release.Info{
FirstDeployed: currentRelease.Info.FirstDeployed,
LastDeployed: ts,
Status: &release.Status{Code: release.Status_UNKNOWN},
Status: &release.Status{Code: release.Status_PENDING},
Description: "Preparing upgrade", // This should be overwritten later.
},
Version: revision,
......
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