LogExecuteHooks executes plugin hooks and config hooks and prints errors to the log
(ctx devspacecontext.Context, extraEnv map[string]interface{}, events ...string)
| 51 | |
| 52 | // LogExecuteHooks executes plugin hooks and config hooks and prints errors to the log |
| 53 | func LogExecuteHooks(ctx devspacecontext.Context, extraEnv map[string]interface{}, events ...string) { |
| 54 | // call plugin first |
| 55 | plugin.LogExecutePluginHookWithContext(extraEnv, events...) |
| 56 | |
| 57 | // now execute hooks |
| 58 | if ctx != nil && ctx.Config() != nil { |
| 59 | if ctx.Log() == nil { |
| 60 | ctx = ctx.WithLogger(logpkg.GetInstance()) |
| 61 | } |
| 62 | |
| 63 | convertedExtraEnv := plugin.ConvertExtraEnv("DEVSPACE_HOOK", extraEnv) |
| 64 | for _, e := range events { |
| 65 | convertedExtraEnv["DEVSPACE_HOOK_EVENT"] = e |
| 66 | err := executeSingle(ctx, convertedExtraEnv, e) |
| 67 | if err != nil { |
| 68 | ctx.Log().Warn(err) |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | // ExecuteHooks executes plugin hooks and config hooks |
| 75 | func ExecuteHooks(ctx devspacecontext.Context, extraEnv map[string]interface{}, events ...string) error { |
no test coverage detected