A simple library to allow programatic copy of a CloudBees DB to a different DB allowing some database reset logic
Groovy Java
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This project enables a repeatable build process to redeploy a CloudBees database snapshot to another database.

The original intention of this project is to enable an easy 'refresh' of development data, by taking an export of another database (possibly production) 
and have this copied to a different database instance for development.

Along with automating the CloudBees API to perform the backup and restore, this application can also execute post restore SQL to 'sanatise' the data ready for development.

The two modules here are the basic Groovy script for driving Cloudbees, and a maven plugin.

To easily support downloading of required dependancies, and also ease of configuration the Maven Plugin is recommended.

Just add the repository to your project:


Once installed you can configure your maven build with XML like:

                        <sql>update USER set email = null</sql>
                        <sql>update USER set password = 'resetpassword'</sql>

As long as you have setup your CloudBees authentication already this plugin should be executable with the command line:

    mvn cloudbees-data:refresh
With this configuration the plugin will locate the latest snapshot from 'myapplication-prod' and restore it to 'myapplication-dev'.

The <applicationDb> tag defines a CloudBees application that will be stopped and restarted before and after the database restore.

You can use the <takeNewSnapshot> tag to define if you want to snapshot the database first, if 'false' will use the most recent available snapshot.

Once the deploy is complete, the system will retreive the database access credentials from the CloudBees API and connect to the DB executing all of the <sql> statements defined in the <postDeploySQL> section.

If you have any issues or problems with the plugin please create an Issue on GitHub and I will work to resolve them.

Many thanks must go to the CloudBees guys, none of this would be possible without their product, and the basis of the Maven Plugin to get this working comes from their Maven Plugin.

PLEASE NOTE:  This project is VERY BETA, so please use at your own risk, I accept no responsibility for any data corruption or loss that this project may cause.  
Please test this with non production DB's first to ensure that your configuration works as expected.