Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions cmd/rig/cmd/capsule/rollout/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package rollout
import (
"context"
"errors"
"fmt"

"github.com/bufbuild/connect-go"
"github.com/rigdev/rig-go-api/api/v1/capsule"
Expand All @@ -12,22 +13,26 @@ import (
)

func (c Cmd) rollback(cmd *cobra.Command, args []string) error {
// Add back in once we have rollback implemented as a Deploy change instead
// ctx := c.Ctx

// rolloutID, err := c.getRollback(ctx)
// if err != nil {
// return err
// }

// resp, err := c.Rig.Capsule().Rollback(ctx, connect.NewRequest(&capsule.RollbackRequest{
// CapsuleId: capsule_cmd.CapsuleID,
// RolloutId: uint64(rolloutID),
// }))
// if err != nil {
// return err
// }
// fmt.Printf("rollback to %v initiated. New rollout has ID %v\n", rolloutID, resp.Msg.GetRolloutId())
ctx := c.Ctx
rolloutID, err := c.getRollback(ctx)
if err != nil {
return err
}

resp, err := c.Rig.Capsule().Deploy(ctx, connect.NewRequest(&capsule.DeployRequest{
CapsuleId: capsule_cmd.CapsuleID,
Changes: []*capsule.Change{{
Field: &capsule.Change_Rollback{
Rollback: &capsule.Rollback{
RollbackId: rolloutID,
},
},
}},
}))
if err != nil {
return err
}
fmt.Printf("rollback to %v initiated. New rollout has ID %v\n", rolloutID, resp.Msg.GetRolloutId())

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ require (
github.com/google/go-containerregistry v0.16.1
github.com/jedib0t/go-pretty/v6 v6.4.6
github.com/lithammer/fuzzysearch v1.1.8
github.com/rigdev/rig-go-api v0.0.0-20230927105546-89bcfced9b22
github.com/rigdev/rig-go-api v0.0.0-20230928083412-68f9a89db6cc
github.com/rigdev/rig-go-sdk v0.0.0-20230918110956-2301fcd9da11
k8s.io/metrics v0.28.0
sigs.k8s.io/controller-runtime v0.16.1
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,10 @@ github.com/rigdev/rig-go-api v0.0.0-20230920122749-0471626a4cc0 h1:leFSeftwUA08p
github.com/rigdev/rig-go-api v0.0.0-20230920122749-0471626a4cc0/go.mod h1:fraLUk9ekeQvvu5bOmUmpNAsBqG2QzqWU9wzGbPwB/w=
github.com/rigdev/rig-go-api v0.0.0-20230927105546-89bcfced9b22 h1:cmx2uVBZ0soEZNV+GDzvIUwlNCdEYt/SJripKpVk8AE=
github.com/rigdev/rig-go-api v0.0.0-20230927105546-89bcfced9b22/go.mod h1:fraLUk9ekeQvvu5bOmUmpNAsBqG2QzqWU9wzGbPwB/w=
github.com/rigdev/rig-go-api v0.0.0-20230928082219-2938cafc0991 h1:DpktlJZVFH5L1G6czoMqMM0sztO5NGKV/tC2s5TNu88=
github.com/rigdev/rig-go-api v0.0.0-20230928082219-2938cafc0991/go.mod h1:fraLUk9ekeQvvu5bOmUmpNAsBqG2QzqWU9wzGbPwB/w=
github.com/rigdev/rig-go-api v0.0.0-20230928083412-68f9a89db6cc h1:7J5GkZvHlO2OqFgHMecQ6x+eXr7cN4k5nSfqFIvUSnQ=
github.com/rigdev/rig-go-api v0.0.0-20230928083412-68f9a89db6cc/go.mod h1:fraLUk9ekeQvvu5bOmUmpNAsBqG2QzqWU9wzGbPwB/w=
github.com/rigdev/rig-go-sdk v0.0.0-20230918110956-2301fcd9da11 h1:cdW4OYPgzr+iMzsqPCLDTRa37rpTRD2OUxhbPApzHss=
github.com/rigdev/rig-go-sdk v0.0.0-20230918110956-2301fcd9da11/go.mod h1:CtN3BUZJfONEGNuVnoewrKHGSHF/XS5OsHxzkA9ToI4=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
Expand Down