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.
- Eclipse.
- 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">
<property file="build.properties"/>
<property environment="env"/>
<target name="fetchChanges">
<sf:retrieve username="${sf1.username}"
password="${sf1.password}"
serverurl="${sf1.serverurl}"
retrieveTarget="src"
unpackaged="package.xml"/>
</target>
<target name="deploy">
<sf:deploy username="${sf2.username}"
password="${sf2.password}"
serverurl="${sf2.serverurl}"
deployRoot="src"
runAllTests="true"
logType="Detail" />
</target>
</project>
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
package.xml –
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>CustomObject</name>
</types>
<types>
<members>*</members>
<name>ApexClass</name>
</types>
<types>
<members>*</members>
<name>ApexPage</name>
</types>
<version>33.0</version>
</Package>
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.
How is this polling for changes? Looking at the Package.xml, it appears that it just retrieves everything and deploys it from the src to the target. I'm not very good with git and don't use bitbucket, is there some step that is using Jenkins to pull the diff of the latest push and HEAD^ and generate the Package.xml with just the changed metadata?
Sudipta, Very nice article on the CI integration pattern. I used Drone as CI with bitbucket + eclipse. Currently, each time code is pushed into bitbucket, it triggers build of the ant script which takes the whole src folder from the repository and deploys it into a sandbox. My intention is actually to push only the changes(for example only the class that is changed) and not the whole source folder.I tried using the target 'fetchChanges' as shown in your build.xml, but looks like it retrieves the whole source folder and not just the changes, is it possible only to deploy the changed class file for example(without specifying it in the package.xml) ?
Sudipta, Very nice article on the CI integration pattern. I used Drone as CI with bitbucket + eclipse. Currently, each time code is pushed into bitbucket, it triggers build of the ant script which takes the whole src folder from the repository and deploys it into a sandbox. My intention is actually to push only the changes(for example only the class that is changed) and not the whole source folder.I tried using the target 'fetchChanges' as shown in your build.xml, but looks like it retrieves the whole source folder and not just the changes, is it possible only to deploy the changed class file for example(without specifying it in the package.xml) ?
hello admin.i am truly cherish it your blog.Because your clarification insightful every one of the themes are excessively good.I got enough information from your blog.Thanks for sharing more.. Devops Training in Bangalore
Devops Training Institute in Bangalore
Best Devops Training in Bangalore
I acknowledge the author for his brilliant work for making this exceptionally useful and informative content to guide us.
salesforce form builder
Very Nice Blog on Continuous integration… Thank you for the Blog.
Devops Training in Bangalore"
Very nice Blog relating SalesForce Development with Jenkins and Git Thank you Sharing.
Devops Training
Nice information my sincere thanks for sharing this post Please Continue to share this post
Devops Training in Bangalore
Very nice post. Awesome article… Really helpful
Great information. Thank you for sharing such post
Thanks for well blog blockchain training in bangalore
python training in bangalore
@sudipta. Just one point, in the above scenario, you are migrating the package.xml from one sandbox to another. Just for my understanding, if you commit something to the master branch, Jenkins should take that package.xml and deploy it to the target sandbox right?
Thanks for the great post…..@ Sudipta De.
Thanks's For sharing….
With regards…..
https://www.svrtechnologies.com/salesforce-developer/salesforce-developer-training
Nice Blog and You Writing Skills Are Top Notch……..
Thanks@Salesforce Developer Training
I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
python training in bangalore
Those guidelines additionally worked to become a good way to
recognize that other people online have the identical fervor like mine
to grasp great deal more around this condition.
aws training in bangalore
aws training in chennai
Those guidelines additionally worked to become a good way to
recognize that other people online have the identical fervor like mine
to grasp great deal more around this condition.
aws training in bangalore
aws training in chennai
Your good knowledge and kindness in playing with all the pieces were
very useful. I don’t know what I would have done if I had not
encountered such a step like this.
aws training in bangalore
aws training in chennai
Thank you a lot for providing individuals with a very
spectacular possibility to read critical reviews from this site.
aws training in bangalore
aws training in chennai
It has been simply incredibly generous with you to provide openly
what exactly many individuals would’ve marketed for an eBook to end
up making some cash for their end, primarily given that you could
have tried it in the event you wanted.
aws training in chennai
aws training in bangalore
I have the same question…..
Yes you are correct Saurav
Thanks fro this great infromative blog.
acte reviews
acte velachery reviews
acte tambaram reviews
acte anna nagar reviews
acte porur reviews
acte omr reviews
acte chennai reviews
acte student reviews
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
blockchain online training
best blockchain online training
top blockchain online training
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
blockchain online training
best blockchain online training
top blockchain online training
Excellent blog!!! I got to know more useful information by reading your blog. Thanks for posting this blog.
Python Training In Pune
python training institute in pune
Thanks for sharing a very useful article.
data science training in chennai
ccna training in chennai
iot training in chennai
cyber security training in chennai
ethical hacking training in chennai
Thanks for Sharing a Very Informative Post & I read Your Article & I must say that is very helpful post for us.
Online Data Science Classes
Selenium Training in Pune
AWS Online Classes
Python Online Classes
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
python Training in chennai
python Course in chennai
That's really impressive and helpful information you have given, very valuable content.
We are also into education and you also can take advantage really awesome job oriented courses
Excellent blog!!! I got to know more useful information by reading your blog. Thanks for posting this blog.salesforce training in chennai
software testing training in chennai
robotic process automation rpa training in chennai
blockchain training in chennai
devops training in chennai
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
python Training in chennai
python Course in chennai
Very nice Post!!! Keep sharing
Dot Net Training in Chennai
Dot Net Course in Coimbatore
Dot Net Training Online
Dot Net Training in Bangalore
great Blog.
Thanks for sharing.
AWS classes in Pune