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

Function ExecutePluginHookWithContext

pkg/devspace/plugin/hook.go:166–196  ·  view source on GitHub ↗
(extraEnv map[string]interface{}, events ...string)

Source from the content-addressed store, hash-verified

164}
165
166func ExecutePluginHookWithContext(extraEnv map[string]interface{}, events ...string) error {
167 if len(plugins) == 0 {
168 return nil
169 }
170
171 // apply global plugin context
172 newEnv := map[string]string{}
173 pluginContextLock.Lock()
174 for k, v := range pluginContext {
175 newEnv[k] = v
176 }
177 pluginContextLock.Unlock()
178
179 // apply extra context
180 convertedExtraEnv := ConvertExtraEnv("DEVSPACE_PLUGIN", extraEnv)
181 for k, v := range convertedExtraEnv {
182 newEnv[k] = v
183 }
184
185 for _, plugin := range plugins {
186 for _, e := range events {
187 newEnv["DEVSPACE_PLUGIN_EVENT"] = e
188 err := executePluginHookAt(plugin, e, newEnv)
189 if err != nil {
190 return err
191 }
192 }
193 }
194
195 return nil
196}
197
198func ConvertExtraEnv(base string, extraEnv map[string]interface{}) map[string]string {
199 out := map[string]string{}

Callers 4

ExecuteHooksFunction · 0.92
LoadWithParserMethod · 0.92

Calls 4

ConvertExtraEnvFunction · 0.85
executePluginHookAtFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected