title: Jenkins - not able to run pipelines from Jenkinsfile
body: <p>I have a Jenkinsfile where the build and tests run on the same Slave.
  My requirement is that the build must be on one Slave (say A) and the tests must run on another slave (say B).</p>
  
  <p>I just setup the slave B and I can see both my slaves A and B in Jenkins->Manage nodes. 
  The problem is that the build stage works successfully , but my prepare_test and test stages are not executed on slave B.</p>
  
  <p>Below are problems seen:</p>
  
  <p>1.) I get the following error after the build stage is successful:</p>
  
  <p>"java.lang.NoSuchMethodError: No such DSL method 'agent' found among steps [archive, bat, build, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, dockerNode, echo, emailext, emailextrecipients, envVarsForTool, error, fileExists, findBuildScans, getContext, git, input, isUnix, junit, library, libraryResource, load, lock, mail, milestone, node, parallel, powershell, properties, publishHTML, pwd, readFile, readTrusted, resolveScm, retry, script, sh, sleep, stage, stash, step, svn, timeout, timestamps, tm, tool, unarchive, unstable, unstash, validateDeclarativePipeline, waitUntil, warnError, withContext, withCredentials, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, wrap, writeFile, ws] or symbols [all, allOf, always, ant, antFromApache, antOutcome, antTarget, any, anyOf, apiToken, architecture, archiveArtifacts, artifactManager, attach, authorizationMatrix, batchFile, booleanParam, branch, brokenBuildSuspects, brokenTestsSuspects, buildButton, buildDiscarder, buildTimestamp, buildTimestamp 
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java
  at java.lang.Thread.run(Thread.java:748)
  Finished: FAILURE
  "</p>
  
  <p>2.) Do not see the stages 'prepare_test' and 'test' for my branch, while I can see the stage related to build.</p>
  
  <p>Attached my jenkinsfile code:</p>
  
  <pre><code>pipeline {
      agent none
      options {
          skipDefaultCheckout true
      }
      stages {
          stage('build') {
              agent {
                  docker {
                      image 'XYZ'
                      args '-v /etc/localtime:/etc/localtime:ro'
                  }
              }
              options { skipDefaultCheckout(true) }
              steps {
                  echo '########################################## Building #########################################'
                  // trigger the build
                  sh 'scm-src/build.sh all-projects'
              }
          }   
  
     }
  } 
  
  
  pipeline {
      agent {
          label 'laptop-hp'
      }
      stages {
          stage('prepare_test') {
                agent {
                   docker {
                      image 'ABC'
                      args '-v /home/jenkins/.ssh/:/home/jenkins/.ssh:ro -v /etc/localtime:/etc/localtime:ro'
                  }
                 }
              options { skipDefaultCheckout(true) }
              steps {
                  echo '####################################### Prepare Test Environment ############################'
                  sh 'scm-src/test.sh prepare'
              }
           }
  
  
          stage('test') {
              agent {
                docker {
                       image 'ABC'
                       args '-v /home/jenkins/.ssh/:/home/jenkins/.ssh:ro -v /etc/localtime:/etc/localtime:ro'
                   }
                 }
  
              options { skipDefaultCheckout(true) }
              steps {
                 echo '########################################## Testing ##########################################'
                  sh 'scm-src/test.sh run'
              }
          }
      }  
  }
  
  
  </code></pre>
  
  <p>The name of my slave B is 'laptop-hp' as seen in Jenkinsfile</p>
  
  <p>Is there a problem with Jenkinsfile or do I miss some settings on my slave B ?</p>
  
  <p>Regards
  kdy</p>