Looking for some feedback to make my plugin work in distributed Jenkins (master/slave) setups

9 views
Skip to first unread message

Daniel Anechitoaie

unread,
Sep 27, 2017, 3:57:12 AM9/27/17
to Jenkins Developers
Hi,

I'm looking for some feedback regarding making my plugin work in distributed Jenkins (master/slave) setups.
For now I have made a "private static class DeployCallable extends MasterToSlaveCallable<Boolean, InterruptedException>" internal class 
with all my code being inside the "public Boolean call() throws InterruptedException" method.
I then just call this method with "launcher.getChannel().call(deployCallable)".



I think current code should work in a distributed Jenkins (master/slave) setup.

I just have one problem, if a user cancels the build from the master my plugin does not get interrupted and still gets executed until the end and only then the job is marked as canceled even tough it still finished doing everything.

I have described this issue here https://issues.jenkins-ci.org/browse/JENKINS-46705

Is there anything that I can do? I'm thinking of breaking my "do it all" "DeployCallable" into smaller pieces. Like one DeployCallable class to prepare the build and return a list of folders to be deployed, then another DeployCallable class that will zip one folder and iterate from master over the list returned by the first callable and then call this other Callable to zip one folder at a time, then another DeployCallable class that will upload the zip files and do the same iterate over the list of zips generated by the previous callable and call this Callable for each zip to upload it.

Would this make sense? I think in this case the interrupted exception might work? But my code will be more complicated and ugly.

What are my options? What can I do? 

Thank you.

Oleg Nenashev

unread,
Sep 27, 2017, 6:36:57 AM9/27/17
to Jenkins Developers
Hi Daniel,

I will check this case. Remoting is expected to interrupt calls on the Remote side: https://github.com/jenkinsci/remoting/blob/a1294d6fd5e0053098a532488aca02586c02a887/src/main/java/hudson/remoting/Request.java#L196-L203

Sorry for the response delay in the ticket, responded there. I'd guess the Interrupted Exception is being suppressed somehow. I check the code. If there is no obvious place, maybe it makes sense to just debug the agent side and to see what happens with the Cancel command.

BR, Oleg

среда, 27 сентября 2017 г., 10:57:12 UTC+3 пользователь Daniel Anechitoaie написал:
Reply all
Reply to author
Forward
0 new messages