TaskListenerDecorator/Factory on agents

31 views
Skip to first unread message

Alexis Tual

unread,
Jun 23, 2023, 11:45:38 AM6/23/23
to Jenkins Developers
Hi,

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 ?

Thanks

Alexis

Jesse Glick

unread,
Jun 28, 2023, 10:47:40 AM6/28/23
to jenkin...@googlegroups.com
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.

Alexis Tual

unread,
Jun 29, 2023, 3:40:18 AM6/29/23
to jenkin...@googlegroups.com
Thanks Jesse for the explanation and pointers, that's very helpful, I'll try something similar.

--
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-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2avo44QofyVg%2Btm0dwrrowXPRRs4HN03J%3DS63VdbPdqQ%40mail.gmail.com.


--

Alexis Tual

Senior Software Engineer



CONFIDENTIALITY NOTICE
: The contents of this email message, and any attachments, are intended solely for the addressee(s) and may contain confidential, proprietary and/or privileged information legally protected from disclosure. If you are not the intended recipient of this communication, or if you received this communication by mistake, please notify the sender immediately and delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, retransmission, dissemination, copying or storage of this message or its attachments is strictly prohibited.
Reply all
Reply to author
Forward
0 new messages