View Distributed Fork on the plugin site for more information.
Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:
This plugin adds a new command 'distfork' to Jenkins CLI, which can be used to execute arbitrary command on a slave of your choice. The distfork command is modeled after ssh, but it's Jenkins aware — for example, instead of hardcoding a machine name, you can specify a label to let Jenkins choose a slave. This opens up a Jenkins cluster for doing all kinds of things without requiring a job/build notion.
- You have a test that involves multiple nodes. Your test script can use
distforkto launch additional JVMs on the Jenkins cluster to carry that out. Such test script can be run from both within Jenkins or from developer's laptops.
- You have some computation that is expensive or require specific environment (say, building JDK or building a virtual machine image.) You can submit such computation to Jenkins from your shell.
- As a basis for distributed scripting.
The following example runs "uname -a" command on a slave with the 'linux' label (if the -l option is optional.)
The following example starts a Tomcat somewhere in a Jenkins cluster, with a port-forwarding from the port 9999 to the HTTP listener of Tomcat.
distforkexecutions are scheduled in the queue and run by an executor, just like normal builds. Thus it makes Jenkins aware of what slaves are busy and what are not.
- Each command execution gets a one-time temporary directory for its working directory. Jenkins will clean this up after the command exits, as well as terminating any remaining background processes to maintain the cluster health.
- Port-forwarding both ways so that you can talk to the remote process without knowing their actual IP addresses.
- Ability to stage the files before the process execution, and ability to bring back files after it ends.
Available Command Line Arguments
-Roptions (file and port forwarding) will not work in a Jenkins with remoting based cli disabled (blog post on new CLI), except in 1.7+ with some modes of
Version 1.7 (Jan 29 2018)
Version 1.6.0 (Mar 20 2017)
Version 1.5.0 (Mar 16 2017)
Now requires Jenkins 1.625.3 or higher.
- Merge PR#6 - if the copy operation fails do not leave a zero length file
Version 1.4.1 (Feb 10 2016)
- fix JENKINS-23567 prevent log spam
- fix JENKINS-16200 use the provided value for duration
- fix JENKINS-32648 log the name of the node used to run the command
Version 1.3 (Feb 25 2011)
- Update for Jenkins
Version 1.1 (Nov 19 2010)
- Update code for more recent Hudson
- Cut off the random meaningless name from the archive
Version 1.0 (Jul 15 2009)
- Initial release