Reputation: 263
I am running a python script from Jenkins which is running a shell script which fails with below Permission denied
error,I tried the following to debug the issue...
1.I am printing the userid
with which the Jenkins job is running and it is the correct user
2.I ran the pre_audit
command manually with the same userid on the Jenkins node and it works fine and there is no permission denied error
This error is only happening when running through Jenkins,am clueless as why this is happening?any pointers on why this is happening or how to debug further despite using the correct user which has the permission ?
2018-05-04 22:09:39 script.py submit_to_techteamweb 469 INFO : userid:username
2018-05-04 22:09:39 script.py submit_to_techteamweb 471 INFO : ./pre_audit --version 9.130.63.0.32.6.27 --chip 4364 --file /Users/username/FWintegration/techteam-automation/integration/release_notes.txt
2018-05-04 22:09:39 script.py submit_to_techteamweb 482 INFO : Printing error...
2018-05-04 22:09:39 script.py submit_to_techteamweb 483 INFO : Traceback (most recent call last):
File "./pre_audit", line 46, in <module>
os.mkdir(submission_directory)
OSError: [Errno 13] Permission denied: '/SWE/Teams/techteam/Firmware/submissions/4364/9.130.63.0.32.6.27
Upvotes: 2
Views: 1619
Reputation: 58858
Is SELinux enabled on the machine? It could be that the Jenkins service is restricted (as it should be) from writing files outside the $WORKDIR
. Creating files outside of the working directory is a Bad Idea™ in Jenkins.
Upvotes: 0
Reputation: 24917
Running shell script from jenkins required proper execution permissions. In your python script before executing your script.sh
run following command:
sh "chmod 755 script.sh"
Upvotes: 2