( ctx context.Context, pinned pluginruntime.PinnedEndpoint, protocolRequest pluginruntime.ProtocolRequestContext, task *model.Task, machine *relay.PluginResponsesMachine, deps pluginProtocolBridgeDeps, )
| 874 | } |
| 875 | |
| 876 | func renderTaskPluginProtocolEventsResponse( |
| 877 | ctx context.Context, |
| 878 | pinned pluginruntime.PinnedEndpoint, |
| 879 | protocolRequest pluginruntime.ProtocolRequestContext, |
| 880 | task *model.Task, |
| 881 | machine *relay.PluginResponsesMachine, |
| 882 | deps pluginProtocolBridgeDeps, |
| 883 | ) (map[string]any, time.Duration, error) { |
| 884 | view, err := service.BuildTaskPluginView(task) |
| 885 | if err != nil { |
| 886 | return nil, 0, err |
| 887 | } |
| 888 | viewValue, err := taskPluginProtocolJSONValue(view) |
| 889 | if err != nil { |
| 890 | return nil, 0, err |
| 891 | } |
| 892 | rendererContext, err := taskPluginProtocolRendererContext( |
| 893 | protocolRequest, |
| 894 | pinned, |
| 895 | task, |
| 896 | deps.artifactContentURL, |
| 897 | ) |
| 898 | if err != nil { |
| 899 | return nil, 0, err |
| 900 | } |
| 901 | hookStarted := deps.now() |
| 902 | value, err := pinned.Plugin.Engine.CallPathWithAdmissionTimeout( |
| 903 | ctx, |
| 904 | deps.admissionTimeout, |
| 905 | "protocols", |
| 906 | []string{pinned.Protocol, "renderEvents"}, |
| 907 | rendererContext, |
| 908 | viewValue, |
| 909 | ) |
| 910 | hookElapsed := deps.now().Sub(hookStarted) |
| 911 | if err != nil { |
| 912 | return nil, hookElapsed, err |
| 913 | } |
| 914 | result, err := relay.DecodePluginProtocolEventResult(value, deps.protocolLimits) |
| 915 | if err != nil { |
| 916 | return nil, hookElapsed, err |
| 917 | } |
| 918 | response, err := machine.FinalFromEvents(result, string(task.Status)) |
| 919 | if err != nil { |
| 920 | return nil, hookElapsed, err |
| 921 | } |
| 922 | return response, hookElapsed, nil |
| 923 | } |
| 924 | |
| 925 | func RetrieveTaskPluginResponse(c *gin.Context) { |
| 926 | retrieveTaskPluginResponse(c, defaultPluginProtocolBridgeDeps()) |
no test coverage detected