node { def remote = [:] remote.name = 'workstation' remote.host = 'workstation' remote.user = 'dany' remote.identityFile = '/var/jenkins_home/.ssh/id_rsa' remote.allowAnyHosts = true remote.agent = false remote.logLevel = 'INFO' stage('Test') { sh 'echo $WORKSPACE; ls -al $WORKSPACE; find /var/jenkins_home -name "test.sh";' } stage('Remote SSH') { sshCommand remote: remote, command: " cd \$(dirname \$(find ~/jenkins/workspace/ant-http@script -name 'Jenkinsfile')); bash test.sh; " sshCommand remote: remote, command: "for i in {1..5}; do echo -n \"Loop \$i \"; date ; sleep 1; done" } }