feat: more info on version changing deployments
continuous-integration/drone/push Build is passing Details

This commit is contained in:
decentral1se 2021-10-14 13:30:33 +02:00
parent 5dd97cace0
commit 0d500b636d
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
3 changed files with 31 additions and 2 deletions

View File

@ -153,3 +153,32 @@ func DeployOverview(app config.App, version string) error {
return nil
}
// NewVersionOverview shows an upgrade or downgrade overview
func NewVersionOverview(app config.App, currentVersion, newVersion string) error {
tableCol := []string{"server", "compose", "domain", "stack", "current version", "to be deployed"}
table := abraFormatter.CreateTable(tableCol)
deployConfig := "compose.yml"
if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok {
deployConfig = strings.Join(strings.Split(composeFiles, ":"), "\n")
}
table.Append([]string{app.Server, deployConfig, app.Domain, app.StackName(), currentVersion, newVersion})
table.Render()
response := false
prompt := &survey.Confirm{
Message: "continue with deployment?",
}
if err := survey.AskOne(prompt, &response); err != nil {
return err
}
if !response {
logrus.Fatal("exiting as requested")
}
return nil
}

View File

@ -144,7 +144,7 @@ data beforehand - see "abra app backup <app>" for more.
}
if !internal.Force {
if err := DeployOverview(app, chosenDowngrade); err != nil {
if err := NewVersionOverview(app, deployedVersion, chosenDowngrade); err != nil {
logrus.Fatal(err)
}
}

View File

@ -131,7 +131,7 @@ data beforehand - see "abra app backup <app>" for more.
}
if !internal.Force {
if err := DeployOverview(app, chosenUpgrade); err != nil {
if err := NewVersionOverview(app, deployedVersion, chosenUpgrade); err != nil {
logrus.Fatal(err)
}
}