diff --git a/README.md b/README.md index 90f9f8e9c..ef1831d64 100755 --- a/README.md +++ b/README.md @@ -377,7 +377,7 @@ Commands: pull Pull an application package from a registry push Push an application package to a registry rm Remove an application - upgrade Upgrade an installed application + update Update a running application validate Checks the rendered application is syntactically correct Run 'docker app COMMAND --help' for more information on a command. diff --git a/e2e/commands_test.go b/e2e/commands_test.go index 2b76c3d57..8cfd36f86 100644 --- a/e2e/commands_test.go +++ b/e2e/commands_test.go @@ -213,10 +213,10 @@ func testDockerAppLifecycle(t *testing.T, useBindMount bool) { }) // Upgrading a failed installation is not allowed - cmd.Command = dockerCli.Command("app", "upgrade", appName) + cmd.Command = dockerCli.Command("app", "update", appName) icmd.RunCmd(cmd).Assert(t, icmd.Expected{ ExitCode: 1, - Err: fmt.Sprintf("Installation %q has failed and cannot be upgraded, reinstall it using 'docker app install'", appName), + Err: fmt.Sprintf("Installation %q has failed and cannot be updated, reinstall it using 'docker app install'", appName), }) // Install a Docker Application Package with an existing failed installation is fine @@ -243,11 +243,11 @@ func testDockerAppLifecycle(t *testing.T, useBindMount bool) { cmd.Command = dockerCli.Command("app", "run", "testdata/simple/simple.dockerapp", "--name", appName) icmd.RunCmd(cmd).Assert(t, icmd.Expected{ ExitCode: 1, - Err: fmt.Sprintf("Installation %q already exists, use 'docker app upgrade' instead", appName), + Err: fmt.Sprintf("Installation %q already exists, use 'docker app update' instead", appName), }) - // Upgrade the application, changing the port - cmd.Command = dockerCli.Command("app", "upgrade", appName, "--set", "web_port=8081") + // Update the application, changing the port + cmd.Command = dockerCli.Command("app", "update", appName, "--set", "web_port=8081") checkContains(t, icmd.RunCmd(cmd).Assert(t, icmd.Success).Combined(), []string{ fmt.Sprintf("Updating service %s_db", appName), diff --git a/e2e/testdata/plugin-usage.golden b/e2e/testdata/plugin-usage.golden index f3a4d3a99..f10669c91 100644 --- a/e2e/testdata/plugin-usage.golden +++ b/e2e/testdata/plugin-usage.golden @@ -18,7 +18,7 @@ Commands: push Push an application package to a registry rm Remove an application run Run an application - upgrade Upgrade an installed application + update Update a running application validate Checks the rendered application is syntactically correct Run 'docker app COMMAND --help' for more information on a command. diff --git a/examples/cnab-simple/README.md b/examples/cnab-simple/README.md index ea4927352..d548d7a34 100755 --- a/examples/cnab-simple/README.md +++ b/examples/cnab-simple/README.md @@ -33,10 +33,10 @@ Install the application: $ docker app install ``` -Upgrade the installation, demonstrating setting parameters: +Update the installation, demonstrating setting parameters: ```console -$ docker app upgrade --set port=9876 --set text="hello DockerCon EU" hello +$ docker app update --set port=9876 --set text="hello DockerCon EU" hello ``` Uninstall the application installation: diff --git a/internal/commands/root.go b/internal/commands/root.go index 6ad954dcd..91bf9adba 100644 --- a/internal/commands/root.go +++ b/internal/commands/root.go @@ -50,7 +50,7 @@ func NewRootCmd(use string, dockerCli command.Cli) *cobra.Command { func addCommands(cmd *cobra.Command, dockerCli command.Cli) { cmd.AddCommand( runCmd(dockerCli), - upgradeCmd(dockerCli), + updateCmd(dockerCli), removeCmd(dockerCli), listCmd(dockerCli), initCmd(dockerCli), diff --git a/internal/commands/run.go b/internal/commands/run.go index 706b9a383..478b2969c 100644 --- a/internal/commands/run.go +++ b/internal/commands/run.go @@ -91,7 +91,7 @@ func runRun(dockerCli command.Cli, appname string, opts runOptions) error { } else { // Return an error in case of successful installation, or even failed upgrade, which means // their was already a successful installation. - return fmt.Errorf("Installation %q already exists, use 'docker app upgrade' instead", installationName) + return fmt.Errorf("Installation %q already exists, use 'docker app update' instead", installationName) } } else { logrus.Debug(err) diff --git a/internal/commands/upgrade.go b/internal/commands/update.go similarity index 69% rename from internal/commands/upgrade.go rename to internal/commands/update.go index bf7f227fc..228ba522e 100644 --- a/internal/commands/upgrade.go +++ b/internal/commands/update.go @@ -10,31 +10,31 @@ import ( "github.com/spf13/cobra" ) -type upgradeOptions struct { +type updateOptions struct { parametersOptions credentialOptions bundleOrDockerApp string } -func upgradeCmd(dockerCli command.Cli) *cobra.Command { - var opts upgradeOptions +func updateCmd(dockerCli command.Cli) *cobra.Command { + var opts updateOptions cmd := &cobra.Command{ - Use: "upgrade INSTALLATION_NAME [--target-context TARGET_CONTEXT] [OPTIONS]", - Short: "Upgrade an installed application", - Example: `$ docker app upgrade myinstallation --target-context=mycontext --set key=value`, + Use: "update [OPTIONS] RUNNING_APP", + Short: "Update a running application", + Example: `$ docker app update myrunningapp --target-context=mycontext --set key=value`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - return runUpgrade(dockerCli, args[0], opts) + return runUpdate(dockerCli, args[0], opts) }, } opts.parametersOptions.addFlags(cmd.Flags()) opts.credentialOptions.addFlags(cmd.Flags()) - cmd.Flags().StringVar(&opts.bundleOrDockerApp, "app-name", "", "Override the installation with another Application Package") + cmd.Flags().StringVar(&opts.bundleOrDockerApp, "image", "", "Override the installation with another Application Package") return cmd } -func runUpgrade(dockerCli command.Cli, installationName string, opts upgradeOptions) error { +func runUpdate(dockerCli command.Cli, installationName string, opts updateOptions) error { defer muteDockerCli(dockerCli)() opts.SetDefaultTargetContext(dockerCli) @@ -49,7 +49,7 @@ func runUpgrade(dockerCli command.Cli, installationName string, opts upgradeOpti } if isInstallationFailed(installation) { - return fmt.Errorf("Installation %q has failed and cannot be upgraded, reinstall it using 'docker app install'", installationName) + return fmt.Errorf("Installation %q has failed and cannot be updated, reinstall it using 'docker app install'", installationName) } if opts.bundleOrDockerApp != "" { @@ -85,11 +85,11 @@ func runUpgrade(dockerCli command.Cli, installationName string, opts upgradeOpti err = u.Run(&installation.Claim, creds, os.Stdout) err2 := installationStore.Store(installation) if err != nil { - return fmt.Errorf("Upgrade failed: %s\n%s", err, errBuf) + return fmt.Errorf("Update failed: %s\n%s", err, errBuf) } if err2 != nil { return err2 } - fmt.Fprintf(os.Stdout, "Application %q upgraded on context %q\n", installationName, opts.targetContext) + fmt.Fprintf(os.Stdout, "Application %q updated on context %q\n", installationName, opts.targetContext) return nil }