Fix #444 #329
|
@ -124,17 +124,15 @@ recipes.
|
|||
}
|
||||
}
|
||||
|
||||
availableDowngrades = internal.ReverseStringList(availableDowngrades)
|
||||
|
||||
var chosenDowngrade string
|
||||
if !internal.Chaos {
|
||||
if len(availableDowngrades) > 0 && !internal.Chaos {
|
||||
if internal.Force || internal.NoInput {
|
||||
chosenDowngrade = availableDowngrades[0]
|
||||
chosenDowngrade = availableDowngrades[len(availableDowngrades)-1]
|
||||
logrus.Debugf("choosing %s as version to downgrade to (--force)", chosenDowngrade)
|
||||
} else {
|
||||
prompt := &survey.Select{
|
||||
Message: fmt.Sprintf("Please select a downgrade (current version: %s):", deployedVersion),
|
||||
Options: availableDowngrades,
|
||||
Options: internal.ReverseStringList(availableDowngrades),
|
||||
}
|
||||
if err := survey.AskOne(prompt, &chosenDowngrade); err != nil {
|
||||
return err
|
||||
|
@ -186,10 +184,8 @@ recipes.
|
|||
config.SetChaosVersionLabel(compose, stackName, chosenDowngrade)
|
||||
config.SetUpdateLabel(compose, stackName, app.Env)
|
||||
|
||||
if !internal.Force {
|
||||
if err := internal.NewVersionOverview(app, deployedVersion, chosenDowngrade, ""); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
if err := internal.NewVersionOverview(app, deployedVersion, chosenDowngrade, ""); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
if err := stack.RunDeploy(cl, deployOpts, compose, stackName, internal.DontWaitConverge); err != nil {
|
||||
|
|
|
@ -127,8 +127,6 @@ recipes.
|
|||
}
|
||||
}
|
||||
|
||||
availableUpgrades = internal.ReverseStringList(availableUpgrades)
|
||||
|
||||
var chosenUpgrade string
|
||||
if len(availableUpgrades) > 0 && !internal.Chaos {
|
||||
if internal.Force || internal.NoInput {
|
||||
|
@ -137,7 +135,7 @@ recipes.
|
|||
} else {
|
||||
prompt := &survey.Select{
|
||||
Message: fmt.Sprintf("Please select an upgrade (current version: %s):", deployedVersion),
|
||||
Options: availableUpgrades,
|
||||
Options: internal.ReverseStringList(availableUpgrades),
|
||||
}
|
||||
if err := survey.AskOne(prompt, &chosenUpgrade); err != nil {
|
||||
return err
|
||||
|
@ -145,6 +143,11 @@ recipes.
|
|||
}
|
||||
}
|
||||
|
||||
if internal.Force && chosenUpgrade == "" {
|
||||
logrus.Warnf("%s is already upgraded to latest but continuing (--force/--chaos)", app.Name)
|
||||
chosenUpgrade = deployedVersion
|
||||
}
|
||||
|
||||
// if release notes written after git tag published, read them before we
|
||||
// check out the tag and then they'll appear to be missing. this covers
|
||||
// when we obviously will forget to write release notes before publishing
|
||||
|
|
|
@ -317,7 +317,7 @@ func EnsureVersion(recipeName, version string) error {
|
|||
logrus.Debugf("read %s as tags for recipe %s", strings.Join(parsedTags, ", "), recipeName)
|
||||
|
||||
if tagRef.String() == "" {
|
||||
return fmt.Errorf("no published release discovered for %s", recipeName)
|
||||
return fmt.Errorf("the local copy of %s doesn't seem to have version %s available?", recipeName, version)
|
||||
}
|
||||
|
||||
worktree, err := repo.Worktree()
|
||||
|
|
Loading…
Reference in New Issue