Skip to content

Commit

Permalink
feat: Add auto approval in restart command.
Browse files Browse the repository at this point in the history
chore: Update go.yml and release.yml versions
  • Loading branch information
anarcher committed Feb 6, 2025
1 parent 141c6cc commit 03d7d26
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Go

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:
Expand All @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.23
- uses: actions/checkout@v3
- name: Run Dagger pipeline
run: go run build/main.go
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: goreleaser
on:
push:
tags:
- 'v*'
- "v*"
jobs:
goreleaser:
runs-on: ubuntu-latest
Expand All @@ -14,7 +14,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.x
go-version: 1.23.x
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
20 changes: 12 additions & 8 deletions pkg/cmd/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
type RestartConfig struct {
rootCfg *RootConfig
targets stringSlice
autoApprove bool
nodeSelector string
}

Expand All @@ -31,6 +32,7 @@ func NewRestartCmd(rootCfg *RootConfig) *ffcli.Command {
fs.String("config", "", "config file (optional)")
fs.Var(&cfg.targets, "target", "only use the specified objects (Format: <namespace>/<type>/<name>)")
fs.StringVar(&cfg.nodeSelector, "node-selector", "", "node label selector used to filter nodes. if value is `empty`, all resources which has no node selector are selected. (Format: empty,group=nodegroup), ")
fs.BoolVar(&cfg.autoApprove, "force", false, "skip interactive approval.")
rootCfg.RegisterFlags(fs)

c := &ffcli.Command{
Expand Down Expand Up @@ -73,15 +75,17 @@ func (c *RestartConfig) Exec(ctx context.Context, args []string) error {

ui.RolloutList(rl)

fmt.Println("")
fmt.Printf(color.GreenString("Do you want to continue and restart? "))
ok, err := ui.AskForConfirm()
if err != nil {
return err
}
if !c.autoApprove {
fmt.Println("")
fmt.Printf(color.GreenString("Do you want to continue and restart? "))
ok, err := ui.AskForConfirm()
if err != nil {
return err
}

if !ok {
return nil
if !ok {
return nil
}
}

for _, r := range rl {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/peterbourgon/ff/v3/ffcli"
)

const Version = "v0.2.0"
const Version = "v0.3.0"

func NewVersionCmd() *ffcli.Command {
c := &ffcli.Command{
Expand Down

0 comments on commit 03d7d26

Please sign in to comment.