Skip to content

Commit 94e27f9

Browse files
committed
[cmd][upgrade] add 'local' option
1 parent 9277450 commit 94e27f9

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

cli/command/upgrade.go

+15-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ var (
5050
)
5151

5252
type upgradeOptions struct {
53-
id string
54-
role string
55-
host string
56-
force bool
53+
id string
54+
role string
55+
host string
56+
force bool
57+
useLocalImage bool
5758
}
5859

5960
func NewUpgradeCommand(curveadm *cli.DingoAdm) *cobra.Command {
@@ -77,6 +78,7 @@ func NewUpgradeCommand(curveadm *cli.DingoAdm) *cobra.Command {
7778
flags.StringVar(&options.role, "role", "*", "Specify service role")
7879
flags.StringVar(&options.host, "host", "*", "Specify service host")
7980
flags.BoolVarP(&options.force, "force", "f", false, "Never prompt")
81+
flags.BoolVar(&options.useLocalImage, "local", false, "Use local image")
8082

8183
return cmd
8284
}
@@ -94,6 +96,15 @@ func genUpgradePlaybook(curveadm *cli.DingoAdm,
9496
}
9597

9698
steps := UPGRADE_PLAYBOOK_STEPS
99+
if options.useLocalImage {
100+
// remove PULL_IMAGE step
101+
for i, item := range steps {
102+
if item == PULL_IMAGE {
103+
steps = append(steps[:i], steps[i+1:]...)
104+
break
105+
}
106+
}
107+
}
97108
pb := playbook.NewPlaybook(curveadm)
98109
for _, step := range steps {
99110
pb.AddStep(&playbook.PlaybookStep{

0 commit comments

Comments
 (0)