Pipeline script step looking script inside job@tmp path

171 views
Skip to first unread message

Mk

unread,
Jun 6, 2023, 6:47:12 AM6/6/23
to Jenkins Users
I'm using Jenkins - 2.375.2 and both Jenkinsfile and script.sh files are in my github repository.

My Jenkinsfile (Declarative Pipeline) content as follows,

pipeline {
    agent any

    stages {
        stage('Checkout') {
            steps {
                git url: 'g...@github.com:org/repository.git'
            }
        }
       
        stage('Script') {
            steps {
                sh 'script.sh'
            }
        }
    }

Any idea why my job goes to below path and looking for script?
+ myscript.sh
/home/user/jenkins/workspace/My_JOB_1@tmp/durable-942e10b9/script.sh: 1: /home/user/jenkins/workspace/My_JOB_1@tmp/durable-942e10b9/script.sh: myscript.sh: not found

I have my script inside this path /home/user/jenkins/workspace/My_JOB_1 path.
Not sure why it has created jobname with @tmp and looking script in that path.

Any advise to fix this problem would be helpful.

Mk

unread,
Jun 6, 2023, 6:54:57 AM6/6/23
to Jenkins Users
sh '$WORKSPACE/script.sh' solved the problem.
Reply all
Reply to author
Forward
0 new messages