add a label to signal that a deploy is connected with a recipe (!264)
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
Resolves coop-cloud/organising#391 by adding the following label `coop-cloud.${STACK_NAME}.recipe=${RECIPE}` (according to the version label). This is required for the auto updater coop-cloud/organising#236 (comment) Co-authored-by: Moritz <moritz.m@local-it.org> Reviewed-on: #264
This commit is contained in:
parent
ca1ea32c46
commit
50db39424c
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -464,3 +464,15 @@ func ExposeAllEnv(stackName string, compose *composetypes.Config, appEnv AppEnv)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SetRecipeLabel adds the label 'coop-cloud.${STACK_NAME}.recipe=${RECIPE}' to the app container
|
||||
// to signal which recipe is connected to the deployed app
|
||||
func SetRecipeLabel(compose *composetypes.Config, stackName string, recipe string) {
|
||||
for _, service := range compose.Services {
|
||||
if service.Name == "app" {
|
||||
logrus.Debugf("set recipe label 'coop-cloud.%s.recipe' to %s for %s", stackName, recipe, stackName)
|
||||
labelKey := fmt.Sprintf("coop-cloud.%s.recipe", stackName)
|
||||
service.Deploy.Labels[labelKey] = recipe
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue