On Fri, Jun 23, 2023 at 11:45 AM Alexis Tual <at...@gradle.com> wrote:

> we're trying to parse any pipeline logs with TaskListenerDecorator to
> detect some pattern and report with a custom action attached to the run.
> It's working fine on agents by default but not when
>
> org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep.USE_WATCHING
>  is
> true. In that case it only works on the builtin node.
> The issue is that the TaskListenerDecorator eventually needs the Run to
> set the action on, and this run is null when executed on agent. How can I
> pass this Run instance so it's available on agents ?
>

You cannot; that is a model object which can only be accessed from inside
the controller.

What you are asking is tricky. The agent must tell the controller to do
something, but normally the controller will not trust anything the agent
says, so the communication has to be designed with care.
https://github.com/jenkinsci/workflow-basic-steps-plugin/blob/6e8791a4448c099cdf6e35bb0ec2601fb88a953a/src/main/java/org/jenkinsci/plugins/workflow/steps/TimeoutStepExecution.java#L298-L311
does something similar; here the `id` is basically an opaque token
generated on the controller and given to the agent, and the only thing the
agent can do is inform the controller that log output from this step in
this build is still being produced. In your case you would need some
similar token but also send back ome information (about a pattern match?)
which should be considered untrusted and sanitized accordingly.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2avo44QofyVg%2Btm0dwrrowXPRRs4HN03J%3DS63VdbPdqQ%40mail.gmail.com.

Reply via email to