@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user