Hi again! I have new interesting task that is not handled by Jenkins functionality.
I have pipeline that interacts with some devices. During interaction I want to capture devices serial output and publish it as Jenkins artifact.
Parallel step will not help me in this case, because:
- Telnet connection will be alive until I will not stop it. So parallel branch will be executing forever
- Parallel step will freezes pipeline execution until all branches are completed
I’m thinking about custom threading implementation in shared library using workflow-api plugin or write own plugin that will extend parallel functionality. For example:
- Releasing threads (should be stopped anyway on build finish.
- Ability to monitor thread state in runtime (Manipulating Future<> to obtain information about thread status/results).
What is “Jenkins way” for such cases? Had somebody experience with such tasks and how you solved it? May be there is some plugin that will help me?
I made some research to understand what is happening.
CpsThreadGroup is an analog of thread pool from Java threading and CpsThread is analog of generic thread from Java threading. Flow node is a task which should be executed by thread. Each CpsThread takes Flow Nodes one by one and executes it. If parallel step called, for each branch CPS thread is created and Flow nodes for each branch are execution bodies (closures) of parallel branches. So in my case I need to inherit CpsThreadGroup or CpsThread, customize execution logic, and invoke them as in parallel step source code?
Am I right in my suggestions?