(ctx devspacecontext.Context, options ResolveOptions, actionName string, action func(ctx devspacecontext.Context, dependency *Dependency) error)
| 64 | } |
| 65 | |
| 66 | func (m *manager) handleDependencies(ctx devspacecontext.Context, options ResolveOptions, actionName string, action func(ctx devspacecontext.Context, dependency *Dependency) error) ([]types.Dependency, error) { |
| 67 | if ctx.Config() == nil || ctx.Config().Config() == nil || len(ctx.Config().Config().Dependencies) == 0 { |
| 68 | return nil, nil |
| 69 | } |
| 70 | |
| 71 | hooksErr := hook.ExecuteHooks(ctx, nil, "before:"+strings.ToLower(actionName)+"Dependencies") |
| 72 | if hooksErr != nil { |
| 73 | return nil, hooksErr |
| 74 | } |
| 75 | |
| 76 | // Resolve all dependencies |
| 77 | dependencies, err := m.resolver.Resolve(ctx, options) |
| 78 | if err != nil { |
| 79 | return nil, errors.Wrap(err, "resolve dependencies") |
| 80 | } |
| 81 | |
| 82 | executedDependencies, err := m.executeDependenciesRecursive(ctx, "", dependencies, options, actionName, action, map[string]bool{}) |
| 83 | if err != nil { |
| 84 | hooksErr := hook.ExecuteHooks(ctx, map[string]interface{}{ |
| 85 | "error": err, |
| 86 | }, "error:"+strings.ToLower(actionName)+"Dependencies") |
| 87 | if hooksErr != nil { |
| 88 | return nil, hooksErr |
| 89 | } |
| 90 | |
| 91 | return nil, err |
| 92 | } |
| 93 | |
| 94 | hooksErr = hook.ExecuteHooks(ctx, nil, "after:"+strings.ToLower(actionName)+"Dependencies") |
| 95 | if hooksErr != nil { |
| 96 | return nil, hooksErr |
| 97 | } |
| 98 | |
| 99 | return executedDependencies, nil |
| 100 | } |
| 101 | |
| 102 | func (m *manager) executeDependenciesRecursive(ctx devspacecontext.Context, base string, dependencies []types.Dependency, options ResolveOptions, actionName string, action func(ctx devspacecontext.Context, dependency *Dependency) error, executedDependenciesIDs map[string]bool) ([]types.Dependency, error) { |
| 103 | // Execute all dependencies |
no test coverage detected