Issue
Can we run Jenkins build for a different machine like my script is on another remote machine and my Jenkins setup is on a different remote machine? I have multiple JMX scripts created on different machines but I want to run them from Jenkins on a single machine
Solution
Yes, there are multiple ways to do this. One way is you can use the Jenkins SSH Steps plugin for this. Following is an example for a remote execution of a command.
node {
def remote = [:]
remote.name = 'test'
remote.host = 'test.domain.com'
remote.user = 'root'
remote.password = 'password'
remote.allowAnyHosts = true
stage('Remote SSH') {
sshCommand remote: remote, command: "ls -lrt"
sshCommand remote: remote, command: "for i in {1..5}; do echo -n \"Loop \$i \"; date ; sleep 1; done"
}
}
Answered By - ycr
Answer Checked By - Clifford M. (JavaFixing Volunteer)