add a label to signal that a deploy is connected with a recipe

This commit is contained in:
Moritz 2023-01-26 13:15:31 +01:00
parent ca1ea32c46
commit 23a0b92d88
4 changed files with 14 additions and 0 deletions

View File

@ -179,6 +179,7 @@ recipes.
logrus.Fatal(err)
}
config.ExposeAllEnv(stackName, compose, app.Env)
config.SetRecipeLabel(compose, stackName, app.Recipe)
if !internal.Force {
if err := internal.NewVersionOverview(app, deployedVersion, chosenDowngrade, ""); err != nil {

View File

@ -190,6 +190,7 @@ recipes.
logrus.Fatal(err)
}
config.ExposeAllEnv(stackName, compose, app.Env)
config.SetRecipeLabel(compose, stackName, app.Recipe)
if err := internal.NewVersionOverview(app, deployedVersion, chosenUpgrade, releaseNotes); err != nil {
logrus.Fatal(err)

View File

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

View File

@ -464,3 +464,14 @@ func ExposeAllEnv(stackName string, compose *composetypes.Config, appEnv AppEnv)
}
}
}
// 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
}
}
}