(ctx devspacecontext.Context, hook *latest.HookConfig, extraEnv map[string]string)
| 29 | } |
| 30 | |
| 31 | func (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 | |
| 64 | func (r *waitHook) execute(ctx context.Context, hook *latest.HookConfig, client kubectl.Client, imageSelector []imageselector.ImageSelector, log logpkg.Logger) error { |
| 65 | labelSelector := "" |
nothing calls this directly
no test coverage detected