I’ve installed Jenkins on Linux, and I’m new to both. I configured a job with a custom workspace /root/xxxx (directory structure already in place). It gives me the following error:
Building in workspace /root/bhanu
java.io.IOException: Failed to mkdirs: /root/bhanu
at hudson.FilePath.mkdirs(FilePath.java:847)
Another question: when executing copy command in Execute Shell build step it gives me ‘permission denied’ error. From the console output the copy command works fine. Here is the error:
+ cp /home/user1/victor.war /root/apache-tomcat-6.0.29/webapps/
cp: accessing '/root/apache-tomcat-6.0.29/webapps/': Permission denied
When I try to set permissions in shell script in Jenkins it gives me ‘permission denied’ error:
+ chmod a+rwx /root/apache-tomcat-6.0.29/webapps/
chmod: cannot access '/root/apache-tomcat-6.0.29/webapps/': Permission denied
Try
to see what user the process has. On Linux, jenkins uses the
JENKINS_USERvariable to define what user it should run as. For a standard Ubuntu package install, the config file in/etc/default/jenkinsspecifies the user in theJENKINS_USERvariable.In the same config file, you can also specify the default workspace location using
JENKINS_HOME. Make sure that is owned by the user you specified inJENKINS_USERto have Jenkins access files.For slave nodes, specify the default workspace on the slave machine in the slave configuration under Manage Jenkins > Manage Nodes > > Configure > Remote FS root. Again, this should have read/write/execute permissions for the
JENKINS_USERuser.