MCPcopy Index your code
hub / github.com/devspace-sh/devspace / ExecuteHooks

Function ExecuteHooks

pkg/devspace/hook/hook.go:75–99  ·  view source on GitHub ↗

ExecuteHooks executes plugin hooks and config hooks

(ctx devspacecontext.Context, extraEnv map[string]interface{}, events ...string)

Source from the content-addressed store, hash-verified

73
74// ExecuteHooks executes plugin hooks and config hooks
75func ExecuteHooks(ctx devspacecontext.Context, extraEnv map[string]interface{}, events ...string) error {
76 // call plugin first
77 err := plugin.ExecutePluginHookWithContext(extraEnv, events...)
78 if err != nil {
79 return err
80 }
81
82 // now execute hooks
83 if ctx != nil && ctx.Config() != nil {
84 if ctx.Log() == nil {
85 ctx = ctx.WithLogger(logpkg.GetInstance())
86 }
87
88 convertedExtraEnv := plugin.ConvertExtraEnv("DEVSPACE_HOOK", extraEnv)
89 for _, e := range events {
90 convertedExtraEnv["DEVSPACE_HOOK_EVENT"] = e
91 err := executeSingle(ctx, convertedExtraEnv, e)
92 if err != nil {
93 return err
94 }
95 }
96 }
97
98 return nil
99}
100
101// executeSingle executes hooks at a specific time
102func executeSingle(ctx devspacecontext.Context, extraEnv map[string]string, event string) error {

Callers 15

DeployMethod · 0.92
deployOneMethod · 0.92
PurgeMethod · 0.92
StartMethod · 0.92
startWithWaitMethod · 0.92
startServicesMethod · 0.92
EnsurePullSecretsMethod · 0.92
RunDependencyPipelinesFunction · 0.92
handleDependenciesMethod · 0.92

Calls 6

ConvertExtraEnvFunction · 0.92
executeSingleFunction · 0.85
ConfigMethod · 0.65
LogMethod · 0.65
WithLoggerMethod · 0.65

Tested by 2

TestHookWithoutExecutionFunction · 0.68
TestHookWithExecutionFunction · 0.68