review: avoid stackName recalculation

This commit is contained in:
2023-03-07 12:23:40 +01:00
parent d120299929
commit 5428ebf43b
3 changed files with 13 additions and 12 deletions

View File

@ -25,6 +25,7 @@ import (
// DeployAction is the main command-line action for this package
func DeployAction(c *cli.Context) error {
app := ValidateApp(c)
stackName := app.StackName()
conf := runtime.New()
cl, err := client.New(app.Server)
@ -47,9 +48,9 @@ func DeployAction(c *cli.Context) error {
logrus.Fatal(err)
}
logrus.Debugf("checking whether %s is already deployed", app.StackName())
logrus.Debugf("checking whether %s is already deployed", stackName)
isDeployed, deployedVersion, err := stack.IsDeployed(context.Background(), cl, app.StackName())
isDeployed, deployedVersion, err := stack.IsDeployed(context.Background(), cl, stackName)
if err != nil {
logrus.Fatal(err)
}
@ -128,7 +129,7 @@ func DeployAction(c *cli.Context) error {
}
deployOpts := stack.Deploy{
Composefiles: composeFiles,
Namespace: app.StackName(),
Namespace: stackName,
Prune: false,
ResolveImage: stack.ResolveImageAlways,
}
@ -136,11 +137,11 @@ func DeployAction(c *cli.Context) error {
if err != nil {
logrus.Fatal(err)
}
config.ExposeAllEnv(app.StackName(), compose, app.Env)
config.SetRecipeLabel(compose, app.StackName(), app.Recipe)
config.SetChaosLabel(compose, app.StackName(), Chaos)
config.SetChaosVersionLabel(compose, app.StackName(), version)
config.SetUpdateLabel(compose, app.StackName(), app.Env)
config.ExposeAllEnv(stackName, compose, app.Env)
config.SetRecipeLabel(compose, stackName, app.Recipe)
config.SetChaosLabel(compose, stackName, Chaos)
config.SetChaosVersionLabel(compose, stackName, version)
config.SetUpdateLabel(compose, stackName, app.Env)
if err := DeployOverview(app, version, "continue with deployment?"); err != nil {
logrus.Fatal(err)