Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 8f1a594

Browse files
authored
Merge pull request #694 from rumpl/ux-upgrade-update
Rename upgrade to update
2 parents b9f8d49 + 32da7d2 commit 8f1a594

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ Commands:
377377
pull Pull an application package from a registry
378378
push Push an application package to a registry
379379
rm Remove an application
380-
upgrade Upgrade an installed application
380+
update Update a running application
381381
validate Checks the rendered application is syntactically correct
382382

383383
Run 'docker app COMMAND --help' for more information on a command.

e2e/commands_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,10 @@ func testDockerAppLifecycle(t *testing.T, useBindMount bool) {
213213
})
214214

215215
// Upgrading a failed installation is not allowed
216-
cmd.Command = dockerCli.Command("app", "upgrade", appName)
216+
cmd.Command = dockerCli.Command("app", "update", appName)
217217
icmd.RunCmd(cmd).Assert(t, icmd.Expected{
218218
ExitCode: 1,
219-
Err: fmt.Sprintf("Installation %q has failed and cannot be upgraded, reinstall it using 'docker app install'", appName),
219+
Err: fmt.Sprintf("Installation %q has failed and cannot be updated, reinstall it using 'docker app install'", appName),
220220
})
221221

222222
// Install a Docker Application Package with an existing failed installation is fine
@@ -244,11 +244,11 @@ func testDockerAppLifecycle(t *testing.T, useBindMount bool) {
244244
cmd.Command = dockerCli.Command("app", "run", "testdata/simple/simple.dockerapp", "--name", appName)
245245
icmd.RunCmd(cmd).Assert(t, icmd.Expected{
246246
ExitCode: 1,
247-
Err: fmt.Sprintf("Installation %q already exists, use 'docker app upgrade' instead", appName),
247+
Err: fmt.Sprintf("Installation %q already exists, use 'docker app update' instead", appName),
248248
})
249249

250-
// Upgrade the application, changing the port
251-
cmd.Command = dockerCli.Command("app", "upgrade", appName, "--set", "web_port=8081")
250+
// Update the application, changing the port
251+
cmd.Command = dockerCli.Command("app", "update", appName, "--set", "web_port=8081")
252252
checkContains(t, icmd.RunCmd(cmd).Assert(t, icmd.Success).Combined(),
253253
[]string{
254254
fmt.Sprintf("Updating service %s_db", appName),

e2e/testdata/plugin-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Commands:
1818
push Push an application package to a registry
1919
rm Remove an application
2020
run Run an application
21-
upgrade Upgrade an installed application
21+
update Update a running application
2222
validate Checks the rendered application is syntactically correct
2323

2424
Run 'docker app COMMAND --help' for more information on a command.

examples/cnab-simple/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ Install the application:
3333
$ docker app install
3434
```
3535

36-
Upgrade the installation, demonstrating setting parameters:
36+
Update the installation, demonstrating setting parameters:
3737

3838
```console
39-
$ docker app upgrade --set port=9876 --set text="hello DockerCon EU" hello
39+
$ docker app update --set port=9876 --set text="hello DockerCon EU" hello
4040
```
4141

4242
Uninstall the application installation:

internal/commands/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func NewRootCmd(use string, dockerCli command.Cli) *cobra.Command {
5050
func addCommands(cmd *cobra.Command, dockerCli command.Cli) {
5151
cmd.AddCommand(
5252
runCmd(dockerCli),
53-
upgradeCmd(dockerCli),
53+
updateCmd(dockerCli),
5454
removeCmd(dockerCli),
5555
listCmd(dockerCli),
5656
initCmd(dockerCli),

internal/commands/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func runRun(dockerCli command.Cli, appname string, opts runOptions) error {
9191
} else {
9292
// Return an error in case of successful installation, or even failed upgrade, which means
9393
// their was already a successful installation.
94-
return fmt.Errorf("Installation %q already exists, use 'docker app upgrade' instead", installationName)
94+
return fmt.Errorf("Installation %q already exists, use 'docker app update' instead", installationName)
9595
}
9696
} else {
9797
logrus.Debug(err)

internal/commands/upgrade.go renamed to internal/commands/update.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@ import (
1010
"github.com/spf13/cobra"
1111
)
1212

13-
type upgradeOptions struct {
13+
type updateOptions struct {
1414
parametersOptions
1515
credentialOptions
1616
bundleOrDockerApp string
1717
}
1818

19-
func upgradeCmd(dockerCli command.Cli) *cobra.Command {
20-
var opts upgradeOptions
19+
func updateCmd(dockerCli command.Cli) *cobra.Command {
20+
var opts updateOptions
2121
cmd := &cobra.Command{
22-
Use: "upgrade INSTALLATION_NAME [--target-context TARGET_CONTEXT] [OPTIONS]",
23-
Short: "Upgrade an installed application",
24-
Example: `$ docker app upgrade myinstallation --target-context=mycontext --set key=value`,
22+
Use: "update [OPTIONS] RUNNING_APP",
23+
Short: "Update a running application",
24+
Example: `$ docker app update myrunningapp --target-context=mycontext --set key=value`,
2525
Args: cobra.ExactArgs(1),
2626
RunE: func(cmd *cobra.Command, args []string) error {
27-
return runUpgrade(dockerCli, args[0], opts)
27+
return runUpdate(dockerCli, args[0], opts)
2828
},
2929
}
3030
opts.parametersOptions.addFlags(cmd.Flags())
3131
opts.credentialOptions.addFlags(cmd.Flags())
32-
cmd.Flags().StringVar(&opts.bundleOrDockerApp, "app-name", "", "Override the installation with another Application Package")
32+
cmd.Flags().StringVar(&opts.bundleOrDockerApp, "image", "", "Override the installation with another Application Package")
3333

3434
return cmd
3535
}
3636

37-
func runUpgrade(dockerCli command.Cli, installationName string, opts upgradeOptions) error {
37+
func runUpdate(dockerCli command.Cli, installationName string, opts updateOptions) error {
3838
defer muteDockerCli(dockerCli)()
3939
opts.SetDefaultTargetContext(dockerCli)
4040

@@ -49,7 +49,7 @@ func runUpgrade(dockerCli command.Cli, installationName string, opts upgradeOpti
4949
}
5050

5151
if isInstallationFailed(installation) {
52-
return fmt.Errorf("Installation %q has failed and cannot be upgraded, reinstall it using 'docker app install'", installationName)
52+
return fmt.Errorf("Installation %q has failed and cannot be updated, reinstall it using 'docker app install'", installationName)
5353
}
5454

5555
if opts.bundleOrDockerApp != "" {
@@ -85,11 +85,11 @@ func runUpgrade(dockerCli command.Cli, installationName string, opts upgradeOpti
8585
err = u.Run(&installation.Claim, creds, os.Stdout)
8686
err2 := installationStore.Store(installation)
8787
if err != nil {
88-
return fmt.Errorf("Upgrade failed: %s\n%s", err, errBuf)
88+
return fmt.Errorf("Update failed: %s\n%s", err, errBuf)
8989
}
9090
if err2 != nil {
9191
return err2
9292
}
93-
fmt.Fprintf(os.Stdout, "Application %q upgraded on context %q\n", installationName, opts.targetContext)
93+
fmt.Fprintf(os.Stdout, "Application %q updated on context %q\n", installationName, opts.targetContext)
9494
return nil
9595
}

0 commit comments

Comments
 (0)