Skip to content

Commit

Permalink
Small rollout related fixes (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatiasFrank authored Oct 30, 2023
1 parent 69de33d commit 4a96de2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
12 changes: 6 additions & 6 deletions cmd/rig/cmd/capsule/builddeploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
container_name "github.com/google/go-containerregistry/pkg/name"
"github.com/jedib0t/go-pretty/v6/progress"
"github.com/rigdev/rig-go-api/api/v1/capsule"
"github.com/rigdev/rig-go-api/api/v1/capsule/rollout"
"github.com/rigdev/rig-go-api/api/v1/cluster"
"github.com/rigdev/rig-go-api/model"
"github.com/rigdev/rig/cmd/common"
Expand Down Expand Up @@ -271,14 +272,13 @@ func (c Cmd) listenForEvents(ctx context.Context, rolloutID uint64, capsuleID st
}
eventCount += len(eventRes.Msg.GetEvents())

switch res.Msg.GetRollout().GetStatus().GetState() {
case capsule.RolloutState_ROLLOUT_STATE_DONE:
switch res.Msg.GetRollout().GetRolloutStatus().GetState() {
case rollout.State_STATE_RUNNING:
fallthrough
case rollout.State_STATE_DONE:
fmt.Printf("[%v] %v\n", time.Now().UTC().Format(time.RFC822), "Deployment complete")
return nil
case capsule.RolloutState_ROLLOUT_STATE_FAILED:
fmt.Printf("[%v] %v\n", time.Now().UTC().Format(time.RFC822), "Deployment failed")
return nil
case capsule.RolloutState_ROLLOUT_STATE_ABORTED:
case rollout.State_STATE_ABORTED:
fmt.Printf("[%v] %v\n", time.Now().UTC().Format(time.RFC822), "Deployment aborted")
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/rig/cmd/capsule/instance/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ func instanceStatusToTableRows(instance *instance.Status) [][]any {
rows[1][0] = ""
stages := instance.GetStages()

rows[0][1] = stages.GetPreparing().GetInfo().GetName()
rows[1][1] = stages.GetPreparing().GetInfo().GetState().String()
rows[0][1] = stages.GetSchedule().GetInfo().GetName()
rows[1][1] = stages.GetSchedule().GetInfo().GetState().String()

rows[0][2] = stages.GetSchedule().GetInfo().GetName()
rows[1][2] = stages.GetSchedule().GetInfo().GetState().String()
rows[0][2] = stages.GetPreparing().GetInfo().GetName()
rows[1][2] = stages.GetPreparing().GetInfo().GetState().String()

rows[0][3] = stages.GetRunning().GetInfo().GetName()
rows[1][3] = stages.GetRunning().GetInfo().GetState().String()
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ 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-20231018082418-d0e5dea8a21e
github.com/rigdev/rig-go-sdk v0.0.0-20230918110956-2301fcd9da11
github.com/rigdev/rig-go-api v0.0.0-20231027112423-d1e69280a555
github.com/rigdev/rig-go-sdk v0.0.0-20231023135215-741e54df3608
github.com/rodaine/table v1.1.0
sigs.k8s.io/controller-runtime v0.16.1
sigs.k8s.io/kind v0.20.0
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,14 @@ github.com/rigdev/rig-go-api v0.0.0-20231012073210-624e23c9f92a h1:VITzGw1adPyJe
github.com/rigdev/rig-go-api v0.0.0-20231012073210-624e23c9f92a/go.mod h1:fraLUk9ekeQvvu5bOmUmpNAsBqG2QzqWU9wzGbPwB/w=
github.com/rigdev/rig-go-api v0.0.0-20231018082418-d0e5dea8a21e h1:rTSrMmYENLyVpZ3Kkmr//UnjikLKjaUshERwQUDq0H4=
github.com/rigdev/rig-go-api v0.0.0-20231018082418-d0e5dea8a21e/go.mod h1:fraLUk9ekeQvvu5bOmUmpNAsBqG2QzqWU9wzGbPwB/w=
github.com/rigdev/rig-go-api v0.0.0-20231025081131-e3c6bcba47ac h1:hNkoZr/YxGlLqLN/0GhIDMWkiz819AcgONGfXrJRQAI=
github.com/rigdev/rig-go-api v0.0.0-20231025081131-e3c6bcba47ac/go.mod h1:fraLUk9ekeQvvu5bOmUmpNAsBqG2QzqWU9wzGbPwB/w=
github.com/rigdev/rig-go-api v0.0.0-20231027112423-d1e69280a555 h1:BRVKpIHxg5avhhG0D0PfPBFgtGF2Nr2ZGuEt2OFAj3k=
github.com/rigdev/rig-go-api v0.0.0-20231027112423-d1e69280a555/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/rigdev/rig-go-sdk v0.0.0-20231023135215-741e54df3608 h1:LeCW6FLcEKDhtHKHssFvjrLwAJUdQc/z4MnNz4f86jM=
github.com/rigdev/rig-go-sdk v0.0.0-20231023135215-741e54df3608/go.mod h1:ZKP8nTitg5YfrFWzP0T58i5A3jSxvkaQPhg3z6KHPZ0=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/capsule_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ func createDeployment(
}

podAnnotations := map[string]string{}
maps.Copy(capsule.Annotations, podAnnotations)
maps.Copy(podAnnotations, capsule.Annotations)
if checksums.files != "" {
podAnnotations[AnnotationChecksumFiles] = checksums.files
}
Expand Down

0 comments on commit 4a96de2

Please sign in to comment.