diff --git a/cmd/monaco/deploy/deploy.go b/cmd/monaco/deploy/deploy.go index ec138b349..5786493e4 100644 --- a/cmd/monaco/deploy/deploy.go +++ b/cmd/monaco/deploy/deploy.go @@ -192,28 +192,29 @@ func validateProjectsWithEnvironments(projects []project.Project, envs manifest. } func collectOpenPipelineCoordinatesByKind(cfgPerType v2.ConfigsPerType, dest KindCoordinates) { - cfgPerType.ForEveryConfigDo(func(cfg config.Config) { + for cfg := range cfgPerType.AllConfigs { if cfg.Skip { - return + continue } if openPipelineType, ok := cfg.Type.(config.OpenPipelineType); ok { dest[openPipelineType.Kind] = append(dest[openPipelineType.Kind], cfg.Coordinate) } - }) + } } func collectPlatformCoordinates(cfgPerType v2.ConfigsPerType) []coordinate.Coordinate { plaformCoordinates := []coordinate.Coordinate{} - cfgPerType.ForEveryConfigDo(func(cfg config.Config) { + + for cfg := range cfgPerType.AllConfigs { if cfg.Skip { - return + continue } if configRequiresPlatform(cfg) { plaformCoordinates = append(plaformCoordinates, cfg.Coordinate) } - }) + } return plaformCoordinates } diff --git a/pkg/project/v2/project.go b/pkg/project/v2/project.go index bd530966e..a95e3c389 100644 --- a/pkg/project/v2/project.go +++ b/pkg/project/v2/project.go @@ -118,17 +118,9 @@ func (p Project) ForEveryConfigInEnvironmentDo(environment string, action Action func (p Project) forEveryConfigDo(environment string, action ActionOverConfig) { for env, cpt := range p.Configs { if environment == "" || environment == env { - cpt.ForEveryConfigDo(action) - } - } -} - -// ForEveryConfigDo executes the given ActionOverConfig actions for each configuration defined in the ConfigsPerType. -// Actions can not modify the configs inside the ConfigsPerType. -func (cpt ConfigsPerType) ForEveryConfigDo(action ActionOverConfig) { - for _, cs := range cpt { - for _, c := range cs { - action(c) + for c := range cpt.AllConfigs { + action(c) + } } } }