title: Jenkins Pipelines: Re-use workspace when loading an external Jenkins pipeline script
body: <p>I have the following use case:</p>
  
  <ol>
  <li><p>Checkout/pull a certain Git revision, using written pipeline script<br>
  (I need this because I retrieve the revision dynamically)</p></li>
  <li><p>From that revision, load a Jenkins-pipeline-file, located among the previously checked out files</p></li>
  <li><p>This file would rely on files from the same checked out revision<br>
  (thus, from the <strong>same</strong> workspace)</p></li>
  </ol>
  
  <p>Problem: The loaded Jenkins-pipeline-file gets executed in a <strong>new</strong> workspace. But it is empty. I need that file to get executed in the <strong>same old</strong> workspace.</p>
  
  <p>I thought, perhaps it's because of surrounding <code>node</code>, because the <code>node</code> keyword creates workspaces, as mentioned in the docs. But when I tried to load it <em>outside</em> the <code>node</code>, Jenkins disallowed this because of "leaving the sandbox".</p>
  
  <p>Note: the jenkins-pipeline-file is found and really gets executed. The problem is <strong>during</strong> the execution.</p>
  
  <hr>
  
  <p><strong>Please look at the example code:</strong></p>
  
  <p><strong><em>Inlined pipeline script</em></strong></p>
  
  <pre><code>node('master') {
    def latestBuildableRevision = readFile '/my/LATEST-BUILDABLE-REVISION.txt'
  
    checkout poll:false,
     scm:[$class:'GitSCM', branches:[[name:latestBuildableRevision]],
     doGenerateSubmoduleConfigurations:false,
     extensions:[[$class: 'CleanBeforeCheckout']], submoduleCfg:[],
      userRemoteConfigs:[[credentialsId:'...', url:'...']]]
  
    load 'further-script-logic.jenkins'
  }
  </code></pre>
  
  <p><strong><em>File: further-script-logic.jenkins</em></strong></p>
  
  <pre><code>node('master') {
     // make use of certain files
     // assumption: pwd() is the *same* workspace which were checked-out before
     // problem: it's not, it's a new empty workspace
  }
  </code></pre>