Copying file from Master to slave

29 views
Skip to first unread message

Nikhil Bhoski

unread,
Feb 26, 2019, 2:44:02 AM2/26/19
to Jenkins Developers
I have my plugin which creates a file in the jenkins workspace. however if i configure slave and force the job to run on slave then i see file on slave is not getting created. 

I am using workspace.getRemote() to get the workspace path and Java File.copy() utility to copy the file in workspace.getRemote() path . However the file is not getting created on slave. Any suggestions to make it work ?

Joseph P

unread,
Feb 26, 2019, 3:12:23 AM2/26/19
to Jenkins Developers
You want to use FilePath class as much as possible, it has methods that work regardless if it is on master or agent.

Ullrich Hafner

unread,
Feb 26, 2019, 3:26:20 AM2/26/19
to Jenkins Developers
Additionally think carefully about the design of your code. Which part of the code should run on the master, which part on the slave. It might be also required to consider MasterToSlaveCallable.



--
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/1e0a992a-6528-4f15-8399-e8ce0befb66f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc
Reply all
Reply to author
Forward
0 new messages