Compare commits

...

10 Commits

Author SHA1 Message Date
e38a0078f3 chore: publish 0.4.0-alpha-rc3 2022-01-04 15:34:10 +01:00
25b44dc54e refactor!: use lowercase option to match others 2022-01-04 12:25:45 +01:00
0c2f6fb676 fix: app autocomplete for secret commands 2022-01-04 12:24:37 +01:00
10e4a8b97f fix: handle StackName/AppName correctly for new app creation 2022-01-04 11:56:29 +01:00
eed2756784 fix: new app table colume matches usual order now 2022-01-04 11:56:17 +01:00
b61b8f0d2a fix: always check for deployed status when removing
You can't delete regardless of -f if an app is deployed, the runtime
will error out. Best just deal with this for all cases then on our side.
2022-01-04 11:38:07 +01:00
763e7b5bff fix: use StackName for querying via Docker 2022-01-04 11:37:45 +01:00
d5ab9aedbf docs: match other abort command outputs 2022-01-04 11:37:35 +01:00
2ebb00c9d4 docs: confirm prompt matches language of command 2022-01-04 11:37:04 +01:00
6d76b3646a fix: use spaces like the rest [ci skip] 2022-01-03 18:41:11 +01:00
5 changed files with 37 additions and 35 deletions

View File

@ -39,13 +39,13 @@ var appRemoveCommand = &cli.Command{
if !internal.Force { if !internal.Force {
response := false response := false
prompt := &survey.Confirm{ prompt := &survey.Confirm{
Message: fmt.Sprintf("about to delete %s, are you sure?", app.Name), Message: fmt.Sprintf("about to remove %s, are you sure?", app.Name),
} }
if err := survey.AskOne(prompt, &response); err != nil { if err := survey.AskOne(prompt, &response); err != nil {
logrus.Fatal(err) logrus.Fatal(err)
} }
if !response { if !response {
logrus.Fatal("user aborted app removal") logrus.Fatal("aborting as requested")
} }
} }
@ -54,7 +54,6 @@ var appRemoveCommand = &cli.Command{
logrus.Fatal(err) logrus.Fatal(err)
} }
if !internal.Force {
isDeployed, _, err := stack.IsDeployed(c.Context, cl, app.StackName()) isDeployed, _, err := stack.IsDeployed(c.Context, cl, app.StackName())
if err != nil { if err != nil {
logrus.Fatal(err) logrus.Fatal(err)
@ -62,10 +61,9 @@ var appRemoveCommand = &cli.Command{
if isDeployed { if isDeployed {
logrus.Fatalf("%s is still deployed. Run \"abra app undeploy %s \" or pass --force", app.Name, app.Name) logrus.Fatalf("%s is still deployed. Run \"abra app undeploy %s \" or pass --force", app.Name, app.Name)
} }
}
fs := filters.NewArgs() fs := filters.NewArgs()
fs.Add("name", app.Name) fs.Add("name", app.StackName())
secretList, err := cl.SecretList(c.Context, types.SecretListOptions{Filters: fs}) secretList, err := cl.SecretList(c.Context, types.SecretListOptions{Filters: fs})
if err != nil { if err != nil {
logrus.Fatal(err) logrus.Fatal(err)
@ -81,6 +79,7 @@ var appRemoveCommand = &cli.Command{
if len(secrets) > 0 { if len(secrets) > 0 {
var secretNamesToRemove []string var secretNamesToRemove []string
if !internal.Force { if !internal.Force {
secretsPrompt := &survey.MultiSelect{ secretsPrompt := &survey.MultiSelect{
Message: "which secrets do you want to remove?", Message: "which secrets do you want to remove?",

View File

@ -20,7 +20,7 @@ import (
var allSecrets bool var allSecrets bool
var allSecretsFlag = &cli.BoolFlag{ var allSecretsFlag = &cli.BoolFlag{
Name: "all", Name: "all",
Aliases: []string{"A"}, Aliases: []string{"a"},
Value: false, Value: false,
Destination: &allSecrets, Destination: &allSecrets,
Usage: "Generate all secrets", Usage: "Generate all secrets",
@ -32,6 +32,7 @@ var appSecretGenerateCommand = &cli.Command{
Usage: "Generate secrets", Usage: "Generate secrets",
ArgsUsage: "<secret> <version>", ArgsUsage: "<secret> <version>",
Flags: []cli.Flag{allSecretsFlag, internal.PassFlag}, Flags: []cli.Flag{allSecretsFlag, internal.PassFlag},
BashComplete: autocomplete.AppNameComplete,
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
app := internal.ValidateApp(c) app := internal.ValidateApp(c)
@ -100,6 +101,7 @@ var appSecretInsertCommand = &cli.Command{
Usage: "Insert secret", Usage: "Insert secret",
Flags: []cli.Flag{internal.PassFlag}, Flags: []cli.Flag{internal.PassFlag},
ArgsUsage: "<app> <secret-name> <version> <data>", ArgsUsage: "<app> <secret-name> <version> <data>",
BashComplete: autocomplete.AppNameComplete,
Description: ` Description: `
This command inserts a secret into an app environment. This command inserts a secret into an app environment.
@ -144,6 +146,7 @@ var appSecretRmCommand = &cli.Command{
Aliases: []string{"rm"}, Aliases: []string{"rm"},
Flags: []cli.Flag{allSecretsFlag, internal.PassFlag}, Flags: []cli.Flag{allSecretsFlag, internal.PassFlag},
ArgsUsage: "<app> <secret-name>", ArgsUsage: "<app> <secret-name>",
BashComplete: autocomplete.AppNameComplete,
Description: ` Description: `
This command removes a secret from an app environment. This command removes a secret from an app environment.

View File

@ -163,9 +163,9 @@ func NewAction(c *cli.Context) error {
NewAppServer = "local" NewAppServer = "local"
} }
tableCol := []string{"Name", "Domain", "Type", "Server"} tableCol := []string{"server", "type", "domain", "app name"}
table := formatter.CreateTable(tableCol) table := formatter.CreateTable(tableCol)
table.Append([]string{sanitisedAppName, Domain, recipe.Name, NewAppServer}) table.Append([]string{NewAppServer, recipe.Name, Domain, NewAppName})
fmt.Println("") fmt.Println("")
fmt.Println(fmt.Sprintf("A new %s app has been created! Here is an overview:", recipe.Name)) fmt.Println(fmt.Sprintf("A new %s app has been created! Here is an overview:", recipe.Name))
@ -173,10 +173,10 @@ func NewAction(c *cli.Context) error {
table.Render() table.Render()
fmt.Println("") fmt.Println("")
fmt.Println("You can configure this app by running the following:") fmt.Println("You can configure this app by running the following:")
fmt.Println(fmt.Sprintf("\n abra app config %s", sanitisedAppName)) fmt.Println(fmt.Sprintf("\n abra app config %s", NewAppName))
fmt.Println("") fmt.Println("")
fmt.Println("You can deploy this app by running the following:") fmt.Println("You can deploy this app by running the following:")
fmt.Println(fmt.Sprintf("\n abra app deploy %s", sanitisedAppName)) fmt.Println(fmt.Sprintf("\n abra app deploy %s", NewAppName))
fmt.Println("") fmt.Println("")
return nil return nil

View File

@ -2,7 +2,7 @@
ABRA_VERSION="0.3.0-alpha" ABRA_VERSION="0.3.0-alpha"
ABRA_RELEASE_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$ABRA_VERSION" ABRA_RELEASE_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$ABRA_VERSION"
RC_VERSION="0.4.0-alpha-rc2" RC_VERSION="0.4.0-alpha-rc3"
RC_VERSION_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$RC_VERSION" RC_VERSION_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$RC_VERSION"
for arg in "$@"; do for arg in "$@"; do