Continuous Integration (CI) is a development practice the allows developers to check-in their changes into a shared repository unlimited number of times. Each check-in is then verified by an automated build system, thus eliminating the changes of breaking some other part of the application while fixing one part.
By implementing Continuous Integration, you can detect errors quickly and locate them more easily. I always recommend to implement Continuous Integration in any kind of software projects. I personally implemented CI multiple times for Java and C++ projects in my career. Now last week, I implemented the same for Salesforce development. In today’s post, I will explain how to do that.
Below are the prerequisite softwares –
- ANT – You can download the software from here.
- Salesforce Migration Tool – Please check the detail steps @ http://www.salesforce.com/us/developer/docs/daas/Content/forcemigrationtool_install.htm
- Git – You can download the software from here.
- Version Controlling in Salesforce with Git + Eclipse.
- Salesforce Deployment Guide using ANT Migration Tool.
- Best Practices – Continuous Integration Techniques.
<project name="Sudipta Deb - Continuous Integration Demo" default="test" basedir="." xmlns:sf="antlib:com.salesforce">
build.properties – (Note: Personally I don’t like giving username+password details in build.properties file, rather I will give those details in next step while configuring ant build step.)
sf1.serverurl = https://test.salesforce.com
sf2.serverurl = https://login.salesforce.com
<?xml version="1.0" encoding="UTF-8"?>
Step 8 –
Here we will configure how frequently Jenkins should check for changes and start build process. For that we need to choose “Poll SCM” option and give “H/15 * * * *” as schedule which will make sure that every 15 mins Jenkins will check for new changes. Below is the screenshot –
Step 10 –
Now we will add post build step which will send the build notification email. Below is the setup –
We are done. Now we can use Jenkins to first retrieve the changes from Sandbox 1, then execute the test cases and finally deploy the changes into Sandbox 2.
I hope now you can configure Continuous Integration for Salesforce Development. Please provide me your feedback. Thanks in advance.