Jenkins Pipeline job can't find script due to @tmp path being created

I am writing a pipeline job that will call another script to execute. The Jenkinsfile and script exist in the same directory and yet the job fails to find the script to run.

This is the relevant bit of script;

  • Diff only changed parts of lines
  • Mouse options not working in Vim on Git-Bash Windows
  • How can I tell whether the current working directory is ignored by Git?
  • Wrong count git commits
  • autopep8 in a git pre-commit — how to automatically recommit?
  • Start-Process “git” returns strange 129 exit code
  • stage ('Update') {
        try {
            dir('jenkins/pipeline/update-jenkins-plugins-ppln') {
                sh 'ls -l'
                sh ''

    which returns the following error;

    [update-jenkins-plugins-ppln] Running shell script
    + ls -l
    total 8
    -rw-r--r-- 1 jenkins jenkins 2441 Dec 20 09:34 Jenkinsfile
    -rwxr-xr-x 1 jenkins jenkins  506 Dec 19 14:06
    [Pipeline] sh
    [update-jenkins-plugins-ppln] Running shell script
    /var/lib/jenkins/workspace/update-jenkins-plugins-ppln/jenkins/pipeline/update-jenkins-plugins-ppln@tmp/durable-11cefdd0/ 2: /var/lib/jenkins/workspace/update-jenkins-plugins-ppln/jenkins/pipeline/update-jenkins-plugins-ppln@tmp/durable-11cefdd0/ not found

    As you can see, the pathing I’m using is correct because according to the ls the file I need is in the directory I’ve pathed to. For some reason though, when actually searching for the script Jenkins is adding @tmp/durable-8d48734f/ onto the path.

    Various troubleshooting:

    • I read that you have to checkout the branch again even if you’re already checking it out to get the Jenkinsfile, so I am.
    • I have ssh’d into the Jenkins box to check and yes, the script is there.

    Why is Jenkins adding the @tmp bit, and is there a way to prevent this behavior?

  • Using dropbox as local Git working repo
  • git reword without resolving merge conflicts again
  • Angular.js Tutorial using the Node.js webserver
  • How to run git rebase interactive mode to remove duplicate commits
  • fatal: The upstream branch of your current branch does not match the name of your current branch
  • Jenkins SCM Sync Configuration Plugin In Docker Won't Talk to Github
  • 2 Solutions collect form web for “Jenkins Pipeline job can't find script due to @tmp path being created”

    I guess your pwd is not in PATH so you have to call it like this: sh './'

    Have you tried using the jenkins workspace environment variable WORKSPACE (absolute path of the workspace)? With that your line would look something like this:

    sh '${WORKSPACE}/jenkins/pipeline/update-jenkins-plugins-ppln/'
    Git Baby is a git and github fan, let's start git clone.