Here\'s my Jenkins 2.x pipeline:
node (\'master\'){
stage \'Checkout\'
checkout scm
stage \"Build Pex\"
sh(\'build.sh\')
}
When
The reason that your script doesn't work is because "build.sh" is not in your PATH.
The Jenkinsfile is running a "sh" script, whose entire contents is the string build.sh. The parent script is in the "@tmp" directory and will always be there - the "@tmp" directory is where Jenkins keeps the Jenkinsfile, essentially, during a run.
To fix the problem, change your line to sh "./build.sh" or sh "bash build.sh", so that the sh block in the Jenkinsfile can correctly locate the build.sh script that you want to execute.