cdog
cdog

Reputation: 523

Jenkins slave not able to find svn

I have a job failing on a slave that builds OK on the master. SVN is installed in the same location on the master as on the slave /usr/local/bin/svn. I have a Jenkins user on the slave and it can run svn --version OK.

[INFO] Executing: /bin/sh -c cd /var/jenkins/workspace/projecta && svn --non-interactive update /var/jenkins/workspace/projecta

[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] /bin/sh: svn: not found

I'm using the Subversion plugin and this works fine on the slave and runs at the start of the job. The problem seems to be that some of the modules use the maven build number plugin.

As you can see in the log above this is running a script which seems to be running as the Jenkins user on the slave and picking up the client on the host which is a different version.

So, I think it is checking out the code with the Subversion plugin version and then trying to up date with the older version on the host's PATH. It all works fine on the master as this only has one version of svn.

Upvotes: 1

Views: 8741

Answers (1)

Sagar
Sagar

Reputation: 9503

Note: Jenkins Shell runs as /bin/sh, not as bash, and so a lot of the paths you expect to be readily available in bash are actually not there. Even if you run svn --version as the jenkins user successfully, chances are you are using bash (and therefore it has loaded certain normal paths into your PATH variable).

OPTION 1

Add the following to your "Execute Shell" or shell script:

PATH=$PATH:/usr/local/bin

That should let it find subversion. However, you have to do this for every job.

OPTION 2 - better option

Another option for you is to add the following on your slave configuration page:

Configure

Environment Variables

name = PATH value = $PATH:/usr/local/bin

This should set it automatically for every build you run on this slave. You can other paths here as you see fit.

Again, note that when you go "System Information" on the slave page, this will not show up (it shows you default Sys Info). However, it will get added for every build

Upvotes: 7

Related Questions