Skip to content
This repository was archived by the owner on Mar 16, 2024. It is now read-only.

Commit 26487bb

Browse files
authored
Merge pull request #954 from cjellick/image-update
Support re-pull through --image flag (issue #948)
2 parents 0de83df + 0a69cfd commit 26487bb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

pkg/cli/update.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,14 @@ func (s *Update) Run(cmd *cobra.Command, args []string) error {
5555
}
5656
}
5757

58-
if s.Pull {
59-
if image != "" {
60-
return fmt.Errorf("cannot set an image (%v) and try to re-pull at the same time", image)
58+
app, err := c.AppGet(cmd.Context(), name)
59+
if err != nil {
60+
return err
61+
}
62+
63+
if s.Pull || image == app.Spec.Image {
64+
if s.Pull && image != "" && image != app.Spec.Image {
65+
return fmt.Errorf("cannot change image (%v) and specify --pull at the same time", image)
6166
}
6267

6368
err := c.AppPullImage(cmd.Context(), name)
@@ -68,11 +73,6 @@ func (s *Update) Run(cmd *cobra.Command, args []string) error {
6873

6974
imageForFlags := image
7075
if imageForFlags == "" {
71-
app, err := c.AppGet(cmd.Context(), name)
72-
if err != nil {
73-
return err
74-
}
75-
7676
imageForFlags = app.Spec.Image
7777

7878
if _, isPattern := autoupgrade.AutoUpgradePattern(imageForFlags); isPattern {
@@ -116,7 +116,7 @@ func (s *Update) Run(cmd *cobra.Command, args []string) error {
116116
return outputApp(s.out, s.Output, app)
117117
}
118118

119-
app, err := rulerequest.PromptUpdate(cmd.Context(), c, s.Dangerous, name, opts)
119+
app, err = rulerequest.PromptUpdate(cmd.Context(), c, s.Dangerous, name, opts)
120120
if err != nil {
121121
return err
122122
}

0 commit comments

Comments
 (0)