Here\'s my Jenkins 2.x pipeline:
node (\'master\'){
stage \'Checkout\'
checkout scm
stage \"Build Pex\"
sh(\'build.sh\')
}
When
Jenkins create a folder when it make a clone from your project like this:
/var/lib/jenkins/workspace/job-name@script
For this to work you must set the file as executable if you are in a linux environment and then call the shell script.
Something like this:
// Permission to execute
sh "chmod +x -R ${env.WORKSPACE}/../${env.JOB_NAME}@script"
// Call SH
sh "${env.WORKSPACE}/../${env.JOB_NAME}@script/script.sh"