6

In Jenkins (Hudson) how do i change the checkout location of a project.

I want the project to be checked out to the doc-root of apache2 which is at /var/svn/project by default Jenkins checks it out to the /jobs dir on /lib/jenkins/

I thought of running a shell command to copy the checked out code from jobs folder to the doc-root but it'll copy the entire folder even if its a single file that has been changed.

Should i look in to rsync or can Jenkins do this (even with a plugin)

heshanh
  • 367
  • 3
  • 6
  • 19
  • So it sounds like you want your Jenkins job to deploy to your Apache server? – Tony Aug 31 '11 at 03:38
  • yep. using the ftp plugin i managed to get it to deploy on our remote server but i cant get it to update the code on the local server. apache and jenkins and svn are all on the same server – heshanh Aug 31 '11 at 03:43
  • Sounds like you should move Jenkins off so you can just use the FTP plugin also. However, you should be able to use the job scripts to get the same effect I would imagine. Our jobs use scp to move files from the Jenkins workspace to where we need them. – Tony Aug 31 '11 at 03:55
  • hmmm i tried rsync but it gives me and error rsync: link_stat "/var/lib/jenkins/jobs/SVN Update - Local/workspace. im guessing this is because of the spaces and the - on my path. – heshanh Aug 31 '11 at 04:19
  • I ended up dong this rsync -auv ./ /var/svn/project/base/ which seem to work – heshanh Aug 31 '11 at 04:57
  • Congrats. Make your last comment the answer and accept it. – Tony Aug 31 '11 at 13:50

2 Answers2

9

There is an option in Jenkins to change the location of your workspace...

On the job configuration page, under the section "Advanced Project Options", click the "Advanced" button.

Check the box near "Use custom workspace", and fill in the location where you want your check-out to go.

Sagar
  • 9,456
  • 6
  • 54
  • 96
  • 1
    My scripts are there in the custom build workspace.. But I want to checkout in separate dir ? it says absolute path is not allowed. How can I do that ? – Amit Apr 26 '13 at 06:23
  • Jenkins will always check out to your workspace - whether it is the default, or a custom workspace. I'm not sure what you mean by your scripts are in the workspace but you want to check out to a different area. – Sagar Apr 26 '13 at 14:42
3

There is no option for this in the Jenkins SVN plugin. I was, however, able to achieve it on Windows with a directory Junction Link - and you could do the same on a *nix installation with a symbolic link.

Specifically, I cd'ed into the Jenkins job/myjob/workspace directory and did this

mklink /J junction_to_working_copy c:\my\real\working\copy

then in the Subversion configuration of the Jenkins project (under Source Code Management) for the "Local module directory (optional)" field I entered:

junction_to_working_copy

This does the trick well enough

Rhubarb
  • 34,705
  • 2
  • 49
  • 38