forked from toolshed/abra
@ -37,10 +37,16 @@ var appDeployCommand = cli.Command{
|
||||
Before: internal.SubCommandBefore,
|
||||
Description: `Deploy an app.
|
||||
|
||||
Use "--force" to re-deploy the same version again.
|
||||
This command supports chaos operations. Use "--chaos" to deploy your recipe
|
||||
checkout as-is. Recipe commit hashes are also supported values for
|
||||
"[<version>]". Please note, "upgrade"/"rollback" do not support chaos
|
||||
operations.
|
||||
|
||||
Use "--chaos" to deploy your local checkout of a recipe as-is, including
|
||||
unstaged changes.`,
|
||||
EXAMPLE:
|
||||
|
||||
abra app deploy foo.example.com
|
||||
abra app deploy foo.example.com 1.2.3+3.2.1
|
||||
abra app deploy foo.example.com 1e83340e`,
|
||||
BashComplete: autocomplete.AppNameComplete,
|
||||
Action: func(c *cli.Context) error {
|
||||
app := internal.ValidateApp(c)
|
||||
@ -71,6 +77,9 @@ unstaged changes.`,
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// NOTE(d1): handles "<version> as git hash" use case
|
||||
var isChaosCommit bool
|
||||
|
||||
// NOTE(d1): check out specific version before dealing with secrets. This
|
||||
// is because we need to deal with GetComposeFiles under the hood and these
|
||||
// files change from version to version which therefore affects which
|
||||
@ -79,9 +88,17 @@ unstaged changes.`,
|
||||
if specificVersion != "" {
|
||||
version = specificVersion
|
||||
log.Debugf("choosing %s as version to deploy", version)
|
||||
if err := app.Recipe.EnsureVersion(version); err != nil {
|
||||
|
||||
var err error
|
||||
isChaosCommit, err = app.Recipe.EnsureVersion(version)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if isChaosCommit {
|
||||
log.Debugf("assuming '%s' is a chaos commit", version)
|
||||
internal.Chaos = true
|
||||
}
|
||||
}
|
||||
|
||||
secStats, err := secret.PollSecretsStatus(cl, app)
|
||||
@ -129,7 +146,7 @@ unstaged changes.`,
|
||||
if len(versions) > 0 && !internal.Chaos {
|
||||
version = versions[len(versions)-1]
|
||||
log.Debugf("choosing %s as version to deploy", version)
|
||||
if err := app.Recipe.EnsureVersion(version); err != nil {
|
||||
if _, err := app.Recipe.EnsureVersion(version); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
} else {
|
||||
@ -145,10 +162,20 @@ unstaged changes.`,
|
||||
chaosVersion := "false"
|
||||
if internal.Chaos {
|
||||
log.Warnf("chaos mode engaged")
|
||||
var err error
|
||||
chaosVersion, err = app.Recipe.ChaosVersion()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
if isChaosCommit {
|
||||
chaosVersion = specificVersion
|
||||
versionLabelLocal, err := app.Recipe.GetVersionLabelLocal()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
version = versionLabelLocal
|
||||
} else {
|
||||
var err error
|
||||
chaosVersion, err = app.Recipe.ChaosVersion()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ var appNewCommand = cli.Command{
|
||||
version = tag
|
||||
}
|
||||
|
||||
if err := recipe.EnsureVersion(version); err != nil {
|
||||
if _, err := recipe.EnsureVersion(version); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
} else {
|
||||
@ -100,7 +100,7 @@ var appNewCommand = cli.Command{
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if err := recipe.EnsureVersion(c.Args().Get(1)); err != nil {
|
||||
if _, err := recipe.EnsureVersion(c.Args().Get(1)); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ var appPsCommand = cli.Command{
|
||||
if statusMeta, ok := statuses[app.StackName()]; ok {
|
||||
isChaos, exists := statusMeta["chaos"]
|
||||
if exists && isChaos == "false" {
|
||||
if err := app.Recipe.EnsureVersion(deployMeta.Version); err != nil {
|
||||
if _, err := app.Recipe.EnsureVersion(deployMeta.Version); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
} else {
|
||||
|
@ -36,11 +36,16 @@ var appRollbackCommand = cli.Command{
|
||||
Description: `
|
||||
This command rolls an app back to a previous version.
|
||||
|
||||
You may pass "--force/-f" to downgrade to the same version again. This can be
|
||||
useful if the container runtime has gotten into a weird state.
|
||||
Unlike "deploy", chaos operations are not supported here. Only recipe versions
|
||||
are supported values for "[<version>]".
|
||||
|
||||
This action could be destructive, please ensure you have a copy of your app
|
||||
data beforehand.`,
|
||||
A rollback can be destructive, please ensure you have a copy of your app data
|
||||
beforehand.
|
||||
|
||||
EXAMPLE:
|
||||
|
||||
abra app rollback foo.example.com
|
||||
abra app rollback foo.example.com 1.2.3+3.2.1`,
|
||||
BashComplete: autocomplete.AppNameComplete,
|
||||
Action: func(c *cli.Context) error {
|
||||
app := internal.ValidateApp(c)
|
||||
@ -169,7 +174,7 @@ data beforehand.`,
|
||||
}
|
||||
|
||||
log.Debugf("choosing %s as version to rollback", chosenDowngrade)
|
||||
if err := app.Recipe.EnsureVersion(chosenDowngrade); err != nil {
|
||||
if _, err := app.Recipe.EnsureVersion(chosenDowngrade); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,16 @@ var appUpgradeCommand = cli.Command{
|
||||
Description: `
|
||||
Upgrade an app.
|
||||
|
||||
This action could be destructive, please ensure you have a copy of your app
|
||||
data beforehand.`,
|
||||
Unlike "deploy", chaos operations are not supported here. Only recipe versions
|
||||
are supported values for "[<version>]".
|
||||
|
||||
An upgrade can be destructive, please ensure you have a copy of your app data
|
||||
beforehand.
|
||||
|
||||
EXAMPLE:
|
||||
|
||||
abra app upgrade foo.example.com
|
||||
abra app upgrade foo.example.com 1.2.3+3.2.1`,
|
||||
BashComplete: autocomplete.AppNameComplete,
|
||||
Action: func(c *cli.Context) error {
|
||||
app := internal.ValidateApp(c)
|
||||
@ -192,7 +200,7 @@ data beforehand.`,
|
||||
}
|
||||
|
||||
log.Debugf("choosing %s as version to upgrade", chosenUpgrade)
|
||||
if err := app.Recipe.EnsureVersion(chosenUpgrade); err != nil {
|
||||
if _, err := app.Recipe.EnsureVersion(chosenUpgrade); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ func processRecipeRepoVersion(r recipe.Recipe, version string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := r.EnsureVersion(version); err != nil {
|
||||
if _, err := r.EnsureVersion(version); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user