title: Continuous Integration Workflow & SVN
body: <p>OK this may be a long one.</p>
  
  <p>I'm trying to standardize and professionalize the setup we have at my workplace for doing live updates to our software. currently, everything is manual; so we have an opportunity to start from scratch.</p>
  
  <p>i have installed jenkins, have repositories to work with, have a job template (based on <a href="http://jenkins-php.org">http://jenkins-php.org</a>) and have the current workflow in mind:</p>
  
  <ul>
  <li>main repository, 'trunk' sat on the development server in its own virtual host</li>
  <li>each developer creates a branch for a specific bug/enhancement/addition, with its own virtual host</li>
  </ul>
  
  <p>1) First question: at this stage, is it recommended practice to run a jenkins job/build once the developer commits to his branch? which would run unit tests and some other stuff (as per the template linked to above)</p>
  
  <ul>
  <li>once the developer branch has been tested, approved, etc - lead developer does a merge of that branch into trunk</li>
  </ul>
  
  <p>2) at this stage, i would like the jenkins job to be re-run again once the merge is complete. is this possible, and the correct way to do this?</p>
  
  <ul>
  <li>once that merge process has been tested and approved, we then do a deployment (im guessing this can be added as a task/target to the deploy job which occurs automatically upon all tests being passed in the step above?) to the live site.</li>
  </ul>
  
  <p>3) i have read somewhere that people also have a trunk checked out on the live site, and the deploy task simply does a svn update rather than doing an FTP task of files. again, is this the correct way to do this?</p>
  
  <p>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<br>
  im also slightly confused by the jenkins workspace. the template i am using is set to dump a folder of build/ into the workspace. with SVN set as an option, this also seems to do a checkout of the project into the workspace. what exactly is the intention of the workspace and what you do with it once its populated?</p>
  
  <p>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<br>
  <strong>UPDATE:</strong>  </p>
  
  <p>on deployment to live servers ... it seems i have 3 options:</p>
  
  <p>1) have a checked out copy of trunk on the live site, .svn files and directories hidden with .htaccess, and run an svn update once ready. the advantages of this are, its fast, it can be rolled back. the downsides are, security issues? </p>
  
  <p>2) svn export to either the live folder directly (taking the site down temporarily during the process) or some other folder and change the apache vhost to the new location</p>
  
  <p>3) use rysnc or similar tool?</p>
  
  <p>which is the better option, or is there a better one i am missing?</p>