Setting up the pre-requisites for Bamboo to execute Salesforce deployments

This is how to set up the necessary pre-requisites for deploying Salesforce.com with Atlassian Bamboo. The steps below are run on an Amazon EC2 Linux instance (see ‘How to set up Atlassian Bamboo on Amazon EC2 in 15 minutes‘), and the only pre-requisite is that this instance is running, with Bamboo installed.

Bamboo Server Pre-Requisites

There are three basic components required on the Bamboo server before deployments can be executed. We will be setting each of them up on the Bamboo server directly.

1. Add Apache Ant to your server

The Salesforce deployment tool we are setting up here uses Apache Ant, and we need to ensure that it is available for Bamboo.

1.1 Logon to your Bamboo server via terminal / command line.

1.2 – Download the latest version of Ant directly to your server.

wget http://mirror.vorboss.net/apache//ant/binaries/apache-ant-1.9.4-bin.tar.gz

1.3 – Unpack the tar.gz file

tar -zxvf apache-ant-1.9.4-bin.tar.gz

1.4 – Move the unpacked folder to a universally accessible folder.

sudo mv apache-ant-1.9.4 ../../usr/local/apache-ant-1.9.4

2. Add the Salesforce Migration tool to Apache Ant

In order to deploy Salesforce code automatically between environments, you need to have the Salesforce Migration Tool installed. This is a mini-application that Salesforce have built to execute deployments using their metadata API.

2.1 – Download the latest version of the Salesforce Migration tool directly to your server.

wget https://eu5.salesforce.com/dwnld/SfdcAnt/salesforce_ant_33.0.zip

2.2 – Unzip the .zip file to a new folder

unzip 'salesforce_ant_33.0.zip' -d salesforce_ant_33

2.3 – Locate the ‘ant-salesforce.jar’ in the unpacked folder and move it into the Apache Ant ‘bin’ folder.

sudo mv salesforce_ant_33/ant-salesforce.jar ../../usr/local/apache-ant-1.9.4/lib

 

3. Add the Salesforce XML Report tool to Apache Ant

The final component we need to add is a publically available extension to the Salesforce.com Migration Tool. It generates a real-time data feed in XML format when running a deployment.

3.1 – Download the latest version of Ant directly to your server.

wget https://force-deploy-with-xml-report-task.googlecode.com/files/ant-deploy-with-xml-report-task-1.4.jar

3.2 – Move the jar to the ant lib folder.

sudo mv ant-deploy-with-xml-report-task-1.4.jar ../../usr/local/apache-ant-1.9.4/lib

The server now has everything it needs to execute a Salesforce deployment.

 

Salesforce Codebase Pre-Requisites

In order to run a deployment, the code base itself needs to have a build.xml file. This file will be used by Apache Ant to batch up the code, and then deploy it.

4.1 – Create a build folder in the Salesforce codebase.

Screen Shot 2015-05-08 at 13.38.07

4.2 – Now download a build.xml file to the ‘build’ folder. Salesforce provide a sample build.xml file in the Migration Tool download (see step 2 above). For this tutorial, I advise downloading a customised build.xml file which I have made for this tutorial from here:

https://github.com/dsmorris85/salesforce-bamboo-build-xml

This XML file is self-contained and does not have any dependencies. It uses variables (that we will set up in Bamboo) for username, password etc, and can be run for constructive and destructive changes.

4.3 – Commit this version of the build.xml to your Stash repository.

Screen Shot 2015-05-08 at 13.58.29

Now you are ready to build your first Bamboo plan and try it out!

 


<– Previous: Developing new features and committing them to Stash

Next: Set up and run your first Bamboo plan–>


 

Additional Points

  • Nothing noted yet

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *


*

Seo wordpress plugin by www.seowizard.org.