vinod
vinod

Reputation: 1115

changing workspace of jenkins in linux

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

Upvotes: 4

Views: 23219

Answers (1)

Martijn Rutten
Martijn Rutten

Reputation: 781

Try

ps aux |grep jenkins

to see what user the process has. On Linux, jenkins uses the JENKINS_USER variable to define what user it should run as. For a standard Ubuntu package install, the config file in /etc/default/jenkins specifies the user in the JENKINS_USER variable.

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 in JENKINS_USER to 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_USER user.

Upvotes: 6

Related Questions