feat: show undploy overview
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
7a5ad65178
commit
c5f44cf340
|
@ -123,7 +123,7 @@ recipes.
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := DeployOverview(app, version); err != nil {
|
if err := DeployOverview(app, version, "continue with deployment?"); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ recipes.
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeployOverview shows a deployment overview
|
// DeployOverview shows a deployment overview
|
||||||
func DeployOverview(app config.App, version string) error {
|
func DeployOverview(app config.App, version, message string) error {
|
||||||
tableCol := []string{"server", "compose", "domain", "stack", "version"}
|
tableCol := []string{"server", "compose", "domain", "stack", "version"}
|
||||||
table := abraFormatter.CreateTable(tableCol)
|
table := abraFormatter.CreateTable(tableCol)
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ func DeployOverview(app config.App, version string) error {
|
||||||
|
|
||||||
response := false
|
response := false
|
||||||
prompt := &survey.Confirm{
|
prompt := &survey.Confirm{
|
||||||
Message: "continue with deployment?",
|
Message: message,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := survey.AskOne(prompt, &response); err != nil {
|
if err := survey.AskOne(prompt, &response); err != nil {
|
||||||
|
|
|
@ -22,12 +22,28 @@ volumes as eligiblef or pruning once undeployed.
|
||||||
`,
|
`,
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
|
stackName := app.StackName()
|
||||||
|
|
||||||
cl, err := client.New(app.Server)
|
cl, err := client.New(app.Server)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logrus.Debugf("checking whether '%s' is already deployed", stackName)
|
||||||
|
|
||||||
|
isDeployed, deployedVersion, err := stack.IsDeployed(c.Context, cl, stackName)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isDeployed {
|
||||||
|
logrus.Fatalf("'%s' is not deployed?", stackName)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := DeployOverview(app, deployedVersion, "continue with undeploy?"); err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
rmOpts := stack.Remove{Namespaces: []string{app.StackName()}}
|
rmOpts := stack.Remove{Namespaces: []string{app.StackName()}}
|
||||||
if err := stack.RunRemove(c.Context, cl, rmOpts); err != nil {
|
if err := stack.RunRemove(c.Context, cl, rmOpts); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
|
|
Loading…
Reference in New Issue