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

Method Execute

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

Source from the content-addressed store, hash-verified

29}
30
31func (r *waitHook) Execute(ctx devspacecontext.Context, hook *latest.HookConfig, extraEnv map[string]string) error {
32 if ctx.KubeClient() == nil {
33 return errors.Errorf("Cannot execute hook '%s': kube client is not initialized", ansi.Color(hookName(hook), "white+b"))
34 }
35
36 var (
37 imageSelectors []imageselector.ImageSelector
38 err error
39 )
40 if hook.Container.ImageSelector != "" {
41 if ctx.Config() == nil || ctx.Config().LocalCache() == nil {
42 return errors.Errorf("Cannot execute hook '%s': config is not loaded", ansi.Color(hookName(hook), "white+b"))
43 }
44
45 if hook.Container.ImageSelector != "" {
46 imageSelector, err := runtime.NewRuntimeResolver(ctx.WorkingDir(), true).FillRuntimeVariablesAsImageSelector(ctx.Context(), hook.Container.ImageSelector, ctx.Config(), ctx.Dependencies())
47 if err != nil {
48 return err
49 }
50
51 imageSelectors = append(imageSelectors, *imageSelector)
52 }
53 }
54
55 err = r.execute(ctx.Context(), hook, ctx.KubeClient(), imageSelectors, ctx.Log())
56 if err != nil {
57 return err
58 }
59
60 ctx.Log().Donef("Hook '%s' successfully executed", ansi.Color(hookName(hook), "white+b"))
61 return nil
62}
63
64func (r *waitHook) execute(ctx context.Context, hook *latest.HookConfig, client kubectl.Client, imageSelector []imageselector.ImageSelector, log logpkg.Logger) error {
65 labelSelector := ""

Callers

nothing calls this directly

Calls 13

executeMethod · 0.95
NewRuntimeResolverFunction · 0.92
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

Tested by

no test coverage detected