Compare commits

...

1 Commits

Author SHA1 Message Date
Moritz 36e7d936fc add a label to signal that a deploy is a chaos deploy 2023-01-31 11:38:55 +01:00
4 changed files with 15 additions and 0 deletions

View File

@ -178,6 +178,7 @@ recipes.
if err != nil {
logrus.Fatal(err)
}
config.SetChaosLabel(compose, stackName, internal.Chaos)
if !internal.Force {
if err := internal.NewVersionOverview(app, deployedVersion, chosenDowngrade, ""); err != nil {

View File

@ -189,6 +189,7 @@ recipes.
if err != nil {
logrus.Fatal(err)
}
config.SetChaosLabel(compose, stackName, internal.Chaos)
if err := internal.NewVersionOverview(app, deployedVersion, chosenUpgrade, releaseNotes); err != nil {
logrus.Fatal(err)

View File

@ -134,6 +134,7 @@ func DeployAction(c *cli.Context) error {
if err != nil {
logrus.Fatal(err)
}
config.SetChaosLabel(compose, app.StackName(), Chaos)
if err := DeployOverview(app, version, "continue with deployment?"); err != nil {
logrus.Fatal(err)

View File

@ -5,6 +5,7 @@ import (
"io/ioutil"
"os"
"path"
"strconv"
"strings"
"github.com/schollz/progressbar/v3"
@ -447,3 +448,14 @@ func GetAppComposeConfig(recipe string, opts stack.Deploy, appEnv AppEnv) (*comp
return compose, nil
}
// add a label to signal that a deploy is a chaos deploy
func SetChaosLabel(compose *composetypes.Config, stackName string, chaos bool) {
for _, service := range compose.Services {
if service.Name == "app" {
logrus.Debugf("set chaos label to %s", chaos)
labelKey := fmt.Sprintf("coop-cloud.%s.chaos", stackName)
service.Deploy.Labels[labelKey] = strconv.FormatBool(chaos)
}
}
}