I'm running Jenkins 1.433 on Ubuntu 11.04 in order to perform a build which includes an Ant task. The clean portion of my Ant task, which deletes the build directory from prior builds, will work when running sudo Ant from the terminal, but fails from Jenkins with the following:
BUILD FAILED
/var/lib/jenkins/workspace/AomaTests/build.xml:47: Unable to delete directory /var/lib/jenkins/workspace/AomaTests/build
The Ant install referenced by Jenkins is the one which works from the command line (usr/bin/ant), and the Jenkins project specifically points to this instance (and not to Default). Figuring this was a permissions problem, I tried the following:
chown -Rthe appropriatebuilddirectory, setting its owner tojenkins.- Doing a
chmod 777on the directory. - Temporarily allowing the
jenkinsusername the ability to run things without a pasword (via editing thesudoersfile with the linejenkins ALL = NOPASSWD:ALL).
None of these approaches workd. Should I be running ant via a different user, or perhaps passing it some properties via Jenkins?
Update: The output of ps -ef | grep "jenkins" is:
jenkins 1647 1 0 12:28 ? 00:00:00 /usr/bin/daemon --name=jenkins --inherit --env=JENKINS_HOME=/var/lib/jenkins --output=/var/log/jenkins/jenkins.log --pidfile=/var/run/jenkins/jenkins.pid -- /usr/bin/java -jar /usr/share/jenkins/jenkins.war --webroot=/var/run/jenkins/war --httpPort=8080 --ajp13Port=-1
jenkins 1660 1647 7 12:28 ? 00:00:13 /usr/bin/java -jar /usr/share/jenkins/jenkins.war --webroot=/var/run/jenkins/war --httpPort=8080 --ajp13Port=-1
mattcarp 2393 2229 0 12:31 pts/0 00:00:00 grep --color=auto jenkins
Running ls -l on the directory that fails to be deleted (when run from Jenkins) shows:
drwxr-xr-x 2 jenkins root 4096 2011-10-03 14:49 build
Many thanks for any advice!
/home/jenkins/aromaTest/workspace/build.xml- David W.