Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup jenkins for automatic checkouts from SVN?

I am trying to configure a jenkins server for build processes. My directory structure is as follows

/home/<user>/projects/MyProject
/home/<user>/projects/MyProject/scripts
/home/<user>/projects/MyProject/trunk

I have given the path upto scrips for custom workspace in jenkins i.e. /home/<user>/projects/MyProject/scripts now I want to checkout the project from SVN trunk to my local trunk. When I am giving path to trunk (/home/<user>/projects/MyProject/trunk) for the local checkout directory (where the project should be checked out), jenkins is showing me that "absolute path is not allowed". How can I give the path upto trunk for svn checkouts by jenkins.

I have spent hours for searching a solution for that i.e. jenkins doc, jenkins forum, hudson docs, hudson forum and here on SO, but couldnt find a solution for this. Please help..

like image 417
Amit Avatar asked Nov 13 '22 06:11

Amit


1 Answers

For various (and reasonable) reasons, each Jenkins job has its own unique workspace. The best practice is to use relative (rather than absolute) paths, and do your builds under the default workspace folder generated by Jenkins.

However, sometimes when dealing with legacy code, paths are hard-coded into build scripts and are difficult to change. In this case, you can use a custom workspace for this build:

  • In a pipeline job, use the ws('/home/<user>/projects/MyProject') { ... } step.
  • In a freestyle job, click the "Advanced" button and check the "Use custom workspace" checkbox, then specify your custom path.
like image 83
Oren Chapo Avatar answered Nov 14 '22 22:11

Oren Chapo