title: How to ssh into a server in Jenkinsfile
body: <pre><code>pipeline {
      agent any
      stages {
          stage('Build React Image') {
              steps {
                  ...
              }
          }
          stage('Push React Image') {
              steps {
                  ...
              }
          }
          stage('Build Backend Image') {
              steps {
                  ...
              }
          }
          stage('Push Backend Image') {
              steps {
                  ...
              }
          }
          def remote = [:]
          remote.name = '...'
          remote.host = '...'
          remote.user = '...'
          remote.password = '...'
          remote.allowAnyHosts = true
          stage('SSH into the server') {
              steps {
                  writeFile file: 'abc.sh', text: 'ls -lrt'
                  sshPut remote: remote, from: 'abc.sh', into: '.'
              }
          }
      }
  }
  </code></pre>
  
  <p>I followed the documentation on this page: <a href="https://jenkins.io/doc/pipeline/steps/ssh-steps/" rel="nofollow noreferrer">https://jenkins.io/doc/pipeline/steps/ssh-steps/</a> to ssh into the server in a Jenkinsfile. My final goal is to ssh into the server, pull from dockerhub, build, and put it up.</p>
  
  <p>First, I just want to successfully ssh into it. </p>
  
  <p>This Jenkinsfile gives me <code>WorkflowScript: 61: Expected a stage @ line 61, column 9. def remote = [:]</code> </p>
  
  <p>Not sure if this the right way to do it. If there is a simpler way to ssh into a server and just perform commands as I do it manually, that would also be great to know.</p>
  
  <p>Thanks in advance.</p>