I am relatively new to Jenkins, and want to pass some run information over to an agent. I’m currently creating a Channel from my controller that can call on the agent, but I don’t know how to read the info on that Channel from the agent’s side.
The getProperty and setProperty methods of Channel seem useful, but I am not sure how to use them if the agent cannot access the run information (which is used to instantiate the Channel).
Do you have an example of your code? I’ve never needed to use a channel before.
I’ve only ever used MasterToSlaveCallable (Jenkins core 2.364 API) with a launcher. This allows your controller to tell your agent to do stuff and return the results. Which is usually what is needed.
You can probably search the GitHub org for examples or I can find some when I’m not mobile.
I’m not necessarily tied to the idea of using a Channel, it just seemed useful.
I have two classes, one that can access run info (RunListener) and the other is a MasterToSlaveCallable extension which doesn’t have the run info.
The call() method in MasterToSlaveCallable does not take any arguments, so it doesn’t seem that I can send the agent any info through this method.