refactor!: --ignore-env-version is --latest *only* on deploy
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
See #617
This commit is contained in:
@ -262,6 +262,14 @@ func validateArgsAndFlags(args []string) error {
|
||||
return errors.New(i18n.G("cannot use [version] and --chaos together"))
|
||||
}
|
||||
|
||||
if len(args) == 2 && args[1] != "" && internal.DeployLatest {
|
||||
return errors.New(i18n.G("cannot use [version] and --latest together"))
|
||||
}
|
||||
|
||||
if internal.DeployLatest && internal.Chaos {
|
||||
return errors.New(i18n.G("cannot use --chaos and --latest together"))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -298,7 +306,7 @@ func getDeployVersion(cliArgs []string, deployMeta stack.DeployMeta, app app.App
|
||||
}
|
||||
|
||||
// Check if the recipe has a version in the .env file
|
||||
if app.Recipe.EnvVersion != "" && !internal.IgnoreEnvVersion {
|
||||
if app.Recipe.EnvVersion != "" && !internal.DeployLatest {
|
||||
if strings.HasSuffix(app.Recipe.EnvVersionRaw, "+U") {
|
||||
return "", errors.New(i18n.G("version: can not redeploy chaos version %s", app.Recipe.EnvVersionRaw))
|
||||
}
|
||||
@ -307,7 +315,7 @@ func getDeployVersion(cliArgs []string, deployMeta stack.DeployMeta, app app.App
|
||||
}
|
||||
|
||||
// Take deployed version
|
||||
if deployMeta.IsDeployed {
|
||||
if deployMeta.IsDeployed && !internal.DeployLatest {
|
||||
log.Debug(i18n.G("version: taking deployed version: %s", deployMeta.Version))
|
||||
return deployMeta.Version, nil
|
||||
}
|
||||
@ -352,4 +360,12 @@ func init() {
|
||||
false,
|
||||
i18n.G("disable converge logic checks"),
|
||||
)
|
||||
|
||||
AppDeployCommand.PersistentFlags().BoolVarP(
|
||||
&internal.DeployLatest,
|
||||
"latest",
|
||||
"l",
|
||||
false,
|
||||
i18n.G("deploy latest recipe version"),
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user