Set chaos version label for each deployed or upgraded app

This commit is contained in:
2023-03-01 12:16:17 +01:00
parent f29278f80a
commit 611430aab2
4 changed files with 14 additions and 0 deletions

View File

@ -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.