title: Execute a script from jenkins pipeline
body: <p>I have a jenkins pipeline that builds a java artifact,
  copies it to a directory and then attempts to execute a external script.</p>
  
  <p>I am using this syntax within the pipeline script to execute the external script</p>
  
  <pre><code>dir('/opt/script-directory') {
      sh './run.sh'
  }
  </code></pre>
  
  <p>The script is just a simple docker build script, but the build will fail
  with this exception:</p>
  
  <pre><code>java.io.IOException: Failed to mkdirs: /opt/script-directory@tmp/durable-ae56483c
  </code></pre>
  
  <p>The error is confusing because the script does not create any directories. It is just building a docker image and placing the freshly built java artifact in that image.</p>
  
  <p>If I create a different job in jenkins that executes the external script as 
  its only build step and then call that job from my pipeline script using this syntax:</p>
  
  <pre><code>build 'docker test build'
  </code></pre>
  
  <p>everything works fine, the script executes within the other job and the pipeline
  continues as expected.</p>
  
  <p>Is this the only way to execute a script that is external to the workspace?</p>
  
  <p>What am I doing wrong with my attempt at executing the script from within
  the pipeline script?</p>