Description/Feature

A plugin for Bamboo that provides support for SVN for flat project structure. More precisely, this plugin allows to specify a custom "extract source" command. For example, you can specify "mvn scm:checkout" command, an Ant script or what you want.

Introduction

Bamboo has out-of-the-box support for SVN repositories, but your project structure must be hierarchical. More specifically, you must point to a single SVN URL, which contains whole project hierarchy. But, if you have a large project with more complex structure, without having a single root SVN URL, this plugin is right for you.

Installation

Just copy bamboo-svnflat-repository-1.x.x.jar to "BAMBOO_HOME/webapp/WEB-INF/lib" directory of your bamboo installation and restart the Bamboo engine.

Configuration

In order to use the SVN-Flat plugin, you need to specify five parameters:

  • SVN user
  • SVN password
  • SVN base URL
  • A checkout command, which is able to extract your flat structure
  • An XML file, which contains SVN URLs of your flat project structure

SVN user/password

These parameters are user in order to connect to your SVN repository

SVN Base URL

This parameter is used to obtain the latest SVN release number from your repository.

Checkout command

You can specify any command line: a shell script, ant script, maven, etc... I am using a home-made maven plugin, which is able to extract a flat structure from SVN. The command line can reference standard Bamboo variables, as well as the following additionnal variables:

  • bamboo.svn.username
  • bamboo.svn.password
  • bamboo.svn.base.url
  • bamboo.svn.revision
  • bamboo.project.base.dir

Example:

${bamboo.capability.mvn} project:extract-flat -Durl=scm:svn:${bamboo.svn.base.url}/dev/test/test-pom/trunk
  -Ddir=${bamboo.project.base.dir}
  -DextractRevision=${bamboo.svn.revision}
XML file that contains SVN URLs

You have to specify a location of an XML file, which must contain all SVN urls of your flat structure. It is used to collect the changes since the last build.

Example:

${bamboo.project.base.dir}/project-info.xml

Here is an example of the content of this file:

<?xml version="1.0"?>
<projects>
  <project>
     <name>test-pom</name>
     <url>scm:svn:svn://svn.nespresso.com/dev/test/test-pom/trunk</url>
     <dir>C:\Appl\Bamboo\bamboo-home\xml-data\build-dir\TEST-DEF\test-pom</dir>
  </project>
  <project>
     <name>test-services</name>
     <url>scm:svn:svn://svn.nespresso.com/dev/test/test-services/trunk</url>
     <dir>C:\Appl\Bamboo\bamboo-home\xml-data\build-dir\TEST-DEF\test-services</dir>
  </project>
  <project>
     <name>test-web</name>
     <url>scm:svn:svn://svn.nespresso.com/dev/test/test-web/trunk</url>
     <dir>C:\Appl\Bamboo\bamboo-home\xml-data\build-dir\TEST-DEF\test-web</dir>
  </project>
  <project>
     <name>test-ear</name>
     <url>scm:svn:svn://svn.nespresso.com/dev/test/test-ear/trunk</url>
     <dir>C:\Appl\Bamboo\bamboo-home\xml-data\build-dir\TEST-DEF\test-ear</dir>
  </project>
</projects>

The plugin uses the following XPATH in order to obtain the URLs: "/projects/project/url"

Remark: You can generate this file within the command that is extracting your flat project structure or use a hand-written one. It is better to generate it during the extraction, because your flat-project structure might change.

Limitations

  • When collecting the changes, the plugin does not use SVN externals
  • All projects must be hosted within the same SVN base URL
  • The SVN password is not (yet) encrypted