diff --git a/cli/app/rollback.go b/cli/app/rollback.go index 9bdf5bdb..1a0e9002 100644 --- a/cli/app/rollback.go +++ b/cli/app/rollback.go @@ -180,6 +180,7 @@ recipes. } config.ExposeAllEnv(compose, app.Env) config.SetChaosLabel(compose, stackName, internal.Chaos) + config.SetRecipeLabel(compose, stackName, app.Recipe) if !internal.Force { if err := internal.NewVersionOverview(app, deployedVersion, chosenDowngrade, ""); err != nil { diff --git a/cli/app/upgrade.go b/cli/app/upgrade.go index 182e5e0a..780366c8 100644 --- a/cli/app/upgrade.go +++ b/cli/app/upgrade.go @@ -191,6 +191,7 @@ recipes. } config.ExposeAllEnv(compose, app.Env) config.SetChaosLabel(compose, stackName, internal.Chaos) + config.SetRecipeLabel(compose, stackName, app.Recipe) if err := internal.NewVersionOverview(app, deployedVersion, chosenUpgrade, releaseNotes); err != nil { logrus.Fatal(err) diff --git a/cli/internal/deploy.go b/cli/internal/deploy.go index 85c3d235..c21d9080 100644 --- a/cli/internal/deploy.go +++ b/cli/internal/deploy.go @@ -136,6 +136,7 @@ func DeployAction(c *cli.Context) error { } config.ExposeAllEnv(compose, app.Env) config.SetChaosLabel(compose, app.StackName(), Chaos) + config.SetRecipeLabel(compose, app.StackName(), app.Recipe) if err := DeployOverview(app, version, "continue with deployment?"); err != nil { logrus.Fatal(err) diff --git a/cli/updater/updater.go b/cli/updater/updater.go index 695e952d..212d9128 100644 --- a/cli/updater/updater.go +++ b/cli/updater/updater.go @@ -237,6 +237,8 @@ func upgrade(cl *dockerclient.Client, stackName string, recipeName string) { logrus.Fatal(err) } config.ExposeAllEnv(compose, app.Env) + // config.SetChaosLabel(compose, stackName, internal.Chaos) + // config.SetRecipeLabel(compose, stackName, app.Recipe) if err := stack.RunDeploy(cl, deployOpts, compose, stackName, true); err != nil { logrus.Fatal(err) diff --git a/pkg/config/app.go b/pkg/config/app.go index 7a8a4ab7..a7dfc4e6 100644 --- a/pkg/config/app.go +++ b/pkg/config/app.go @@ -473,3 +473,14 @@ func SetChaosLabel(compose *composetypes.Config, stackName string, chaos bool) { } } } + +// add a label to signal that a deploy is connected with a recipe +func SetRecipeLabel(compose *composetypes.Config, stackName string, recipe string) { + for _, service := range compose.Services { + if service.Name == "app" { + logrus.Debugf("set recipe label to %s", recipe) + labelKey := fmt.Sprintf("coop-cloud.%s.recipe", stackName) + service.Deploy.Labels[labelKey] = recipe + } + } +}