I have some trouble with this situation:
everytime I create a new pipeline job ( entitled "pipeline"), the sh
step won't work even with simple command like ls
or pwd
and it returns this log:
sh: 1: /var/jenkins_home/workspace/pipeline@tmp/durable-34c21b81/script.sh: Permission denied
Any suggestions?
To fix the Jenkins Docker permission denied error, just run a usermod command in the terminal and reboot.
For solving this error, you need to add the correct permissions to the file to execute. However, you need to be a “root” user or have sudo access for changing the permission. For changing the permission, Linux offers a chmod command. The chmod stands for change mod.
Usually, you get the error bash permission denied when running some script/file that does not have execute permissions. It is one of the most common Magento errors. All you need to do to fix it is to change file permissions and add executive one.
I guess you use
stage(name){
sh ./runSomething
}
Jenkins always uses to user jenkins for running scripts. There are some possibilities:
I was getting a similar permissions denied error after following the Jenkins pipeline tutorial for a node project.
./jenkins/test.sh: Permission denied
The original pipeline Test stage looked like the following and returned that error.
stage('Test') {
steps {
sh './jenkins/test.sh'
}
}
I found the following post: https://stackoverflow.com/a/61956744/9109504 and modified the Test stage to the following
stage('Test') {
steps {
sh "chmod +x -R ${env.WORKSPACE}"
sh './jenkins/test.sh'
}
}
That change fixed the permissions denied error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With