forked from toolshed/abra
@ -20,6 +20,9 @@ var appUpgradeCommand = &cli.Command{
|
||||
Aliases: []string{"u"},
|
||||
Usage: "Upgrade an app",
|
||||
ArgsUsage: "<app>",
|
||||
Flags: []cli.Flag{
|
||||
internal.ForceFlag,
|
||||
},
|
||||
Description: `
|
||||
This command supports upgrading an app. You can use it to choose and roll out a
|
||||
new upgrade to an existing app. This command specifically supports changing the
|
||||
@ -44,11 +47,11 @@ could be destructive, please ensure you have a copy of your app data beforehand
|
||||
}
|
||||
|
||||
if deployedVersion == "" {
|
||||
logrus.Fatal("failed to determine version of deployed '%s'", app.Name)
|
||||
logrus.Fatalf("failed to determine version of deployed '%s'", app.Name)
|
||||
}
|
||||
|
||||
if !isDeployed {
|
||||
logrus.Fatal("'%s' is not deployed?", app.Name)
|
||||
logrus.Fatalf("'%s' is not deployed?", app.Name)
|
||||
}
|
||||
|
||||
versions, err := catalogue.GetRecipeCatalogueVersions(app.Type)
|
||||
@ -76,12 +79,19 @@ could be destructive, please ensure you have a copy of your app data beforehand
|
||||
}
|
||||
|
||||
var chosenUpgrade string
|
||||
prompt := &survey.Select{
|
||||
Message: "Please select an upgrade:",
|
||||
Options: availableUpgrades,
|
||||
if !internal.Force {
|
||||
prompt := &survey.Select{
|
||||
Message: fmt.Sprintf("Please select an upgrade (current version: '%s'):", deployedVersion),
|
||||
Options: availableUpgrades,
|
||||
}
|
||||
if err := survey.AskOne(prompt, &chosenUpgrade); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := survey.AskOne(prompt, &chosenUpgrade); err != nil {
|
||||
return err
|
||||
|
||||
if internal.Force {
|
||||
chosenUpgrade = availableUpgrades[len(availableUpgrades)-1]
|
||||
logrus.Debugf("choosing '%s' as version to upgrade to", chosenUpgrade)
|
||||
}
|
||||
|
||||
if err := recipe.EnsureVersion(app.Type, chosenUpgrade); err != nil {
|
||||
@ -112,8 +122,10 @@ could be destructive, please ensure you have a copy of your app data beforehand
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
if err := DeployOverview(app, chosenUpgrade); err != nil {
|
||||
logrus.Fatal(err)
|
||||
if !internal.Force {
|
||||
if err := DeployOverview(app, chosenUpgrade); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := stack.RunDeploy(cl, deployOpts, compose); err != nil {
|
||||
|
Reference in New Issue
Block a user