diff --git a/cli/app/rollback.go b/cli/app/rollback.go index a13acbc8..c99f3ebe 100644 --- a/cli/app/rollback.go +++ b/cli/app/rollback.go @@ -183,6 +183,7 @@ recipes. config.ExposeAllEnv(stackName, compose, app.Env) config.SetRecipeLabel(compose, stackName, app.Recipe) config.SetChaosLabel(compose, stackName, internal.Chaos) + config.SetChaosVersionLabel(compose, app.StackName(), chosenDowngrade) config.SetUpdateLabel(compose, stackName, app.Env) if !internal.Force { diff --git a/cli/app/upgrade.go b/cli/app/upgrade.go index 2784d9f4..9780fa91 100644 --- a/cli/app/upgrade.go +++ b/cli/app/upgrade.go @@ -194,6 +194,7 @@ recipes. config.ExposeAllEnv(stackName, compose, app.Env) config.SetRecipeLabel(compose, stackName, app.Recipe) config.SetChaosLabel(compose, stackName, internal.Chaos) + config.SetChaosVersionLabel(compose, app.StackName(), chosenUpgrade) config.SetUpdateLabel(compose, stackName, app.Env) if err := internal.NewVersionOverview(app, deployedVersion, chosenUpgrade, releaseNotes); err != nil { diff --git a/cli/internal/deploy.go b/cli/internal/deploy.go index da4b26cb..44775d3d 100644 --- a/cli/internal/deploy.go +++ b/cli/internal/deploy.go @@ -139,6 +139,7 @@ func DeployAction(c *cli.Context) error { 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) if err := DeployOverview(app, version, "continue with deployment?"); err != nil { diff --git a/pkg/config/app.go b/pkg/config/app.go index 6631503d..f7c528f5 100644 --- a/pkg/config/app.go +++ b/pkg/config/app.go @@ -499,6 +499,17 @@ func SetChaosLabel(compose *composetypes.Config, stackName string, chaos bool) { } } +// SetChaosVersionLabel adds the label 'coop-cloud.${STACK_NAME}.chaos_version=$(GIT_COMMIT)' to the app container +func SetChaosVersionLabel(compose *composetypes.Config, stackName string, chaosVersion string) { + for _, service := range compose.Services { + if service.Name == "app" { + logrus.Debugf("set label 'coop-cloud.%s.chaos_version' to %v for %s", stackName, chaosVersion, stackName) + labelKey := fmt.Sprintf("coop-cloud.%s.chaos_version", stackName) + service.Deploy.Labels[labelKey] = chaosVersion + } + } +} + // SetUpdateLabel adds env ENABLE_AUTO_UPDATE as label to enable/disable the // auto update process for this app. The default if this variable is not set is to disable // the auto update process.