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

Method Execute

pkg/devspace/hook/remote_hook.go:41–73  ·  view source on GitHub ↗
(ctx devspacecontext.Context, hook *latest.HookConfig, extraEnv map[string]string)

Source from the content-addressed store, hash-verified

39}
40
41func (r *remoteHook) Execute(ctx devspacecontext.Context, hook *latest.HookConfig, extraEnv map[string]string) error {
42 if ctx.KubeClient() == nil {
43 return errors.Errorf("Cannot execute hook '%s': kube client is not initialized", ansi.Color(hookName(hook), "white+b"))
44 }
45
46 var (
47 imageSelectors []imageselector.ImageSelector
48 err error
49 )
50 if hook.Container.ImageSelector != "" {
51 if ctx.Config() == nil || ctx.Config().LocalCache() == nil {
52 return errors.Errorf("Cannot execute hook '%s': config is not loaded", ansi.Color(hookName(hook), "white+b"))
53 }
54
55 if hook.Container.ImageSelector != "" {
56 imageSelector, err := runtimevar.NewRuntimeResolver(ctx.WorkingDir(), true).FillRuntimeVariablesAsImageSelector(ctx.Context(), hook.Container.ImageSelector, ctx.Config(), ctx.Dependencies())
57 if err != nil {
58 return err
59 }
60
61 imageSelectors = append(imageSelectors, *imageSelector)
62 }
63 }
64
65 executed, err := r.execute(ctx, hook, imageSelectors)
66 if err != nil {
67 return err
68 } else if !executed {
69 ctx.Log().Infof("Skip hook '%s', because no running containers were found", ansi.Color(hookName(hook), "white+b"))
70 }
71
72 return nil
73}
74
75func (r *remoteHook) execute(ctx devspacecontext.Context, hook *latest.HookConfig, imageSelector []imageselector.ImageSelector) (bool, error) {
76 labelSelector := ""

Callers

nothing calls this directly

Calls 12

executeMethod · 0.95
hookNameFunction · 0.85
KubeClientMethod · 0.65
ConfigMethod · 0.65
LocalCacheMethod · 0.65
WorkingDirMethod · 0.65
ContextMethod · 0.65
DependenciesMethod · 0.65
LogMethod · 0.65
ErrorfMethod · 0.45
InfofMethod · 0.45

Tested by

no test coverage detected