feat(deploy): Simplifies deploy overview (#508)

This simplifies the deploy overview, to only show 3 version fields:
- CURRENT DEPLOYMENT
- CURRENT ENV
- NEW DEPLOYMENT

It also fixes a few errors around version detection

Reviewed-on: toolshed/abra#508
Co-authored-by: p4u1 <p4u1_f4u1@riseup.net>
Co-committed-by: p4u1 <p4u1_f4u1@riseup.net>
This commit is contained in:
2025-03-12 16:13:24 +00:00
committed by p4u1
parent d09a19a385
commit e58a716fe1
23 changed files with 263 additions and 641 deletions

View File

@ -43,7 +43,8 @@ beforehand. See "abra app backup" for more.`,
ValidArgsFunction: func(
cmd *cobra.Command,
args []string,
toComplete string) ([]string, cobra.ShellCompDirective) {
toComplete string,
) ([]string, cobra.ShellCompDirective) {
switch l := len(args); l {
case 0:
return autocomplete.AppNameComplete()
@ -206,23 +207,21 @@ beforehand. See "abra app backup" for more.`,
return
}
chaosVersion := config.CHAOS_DEFAULT
if deployMeta.IsChaos {
chaosVersion = deployMeta.ChaosVersion
if deployMeta.ChaosVersion == "" {
chaosVersion = config.UNKNOWN_DEFAULT
}
if upgradeReleaseNotes != "" && chosenUpgrade != "" {
fmt.Print(upgradeReleaseNotes)
} else {
upgradeWarnMessages = append(
upgradeWarnMessages,
fmt.Sprintf("no release notes available for %s", chosenUpgrade),
)
}
if err := internal.NewVersionOverview(
if err := internal.DeployOverview(
app,
upgradeWarnMessages,
"upgrade",
deployMeta.Version,
chaosVersion,
chosenUpgrade,
upgradeReleaseNotes,
upgradeWarnMessages,
); err != nil {
log.Fatal(err)
}
@ -365,7 +364,7 @@ func validateUpgradeVersionArg(
parsedDeployedVersion, err := tagcmp.Parse(deployMeta.Version)
if err != nil {
return err
return fmt.Errorf("'%s' is not a known version", deployMeta.Version)
}
if parsedSpecificVersion.IsLessThan(parsedDeployedVersion) &&
@ -397,9 +396,7 @@ func ensureDeployed(cl *dockerClient.Client, app app.App) (stack.DeployMeta, err
return deployMeta, nil
}
var (
showReleaseNotes bool
)
var showReleaseNotes bool
func init() {
AppUpgradeCommand.Flags().BoolVarP(