Continuous integration using Jenkins
Author
February 5, 2016
For administrators working with a single company, changesets are a great way to move updates between sandboxes and a parent org. However, when working on the enterprise tier, we often need to transfer components between various test and developer environments, which are outside the scope of changesets.
To support multiple developers working across multiple environments on various features and fixes, a proven path is to use an automated continuous integration system to simplify deployments and promote transparency.
Continuous integration
The concept behind a continuous integration, or CI, tool is that a constant flow of development changes and unit testing will be done to detect conflicts and errors within the development cycle itself. It allows you to perform a baseline of quality assurance without much reliance on any manual processes (at least until you get that notification that your code just broke the build). The flow is something like:
1) Download and install JRE 6: Verify the correct installation by executing the following command: java version.
2) Download and Install Ant (version 1.6 or higher) zip file from http://ant.apache.org/bindownload.cgi and set environment variable.
3) Download Force.com Migration Tool zip folder from Salesforce Org for which the path is as follows: Develop->Tools->Force.com Migration Tools.
4) Copy the “ant-salesforce.jar” file from the above extracted folder and paste it in the lib directory of the installed Ant folder.
5) Set the environment Variables as follows:
->System Variables->new>Â Variable Name: ANT_HOME
Variable Value: C:\Program Files\apache-ant-x.xx.x
->System Variables->new>Â Variable Name: JAVA_HOME
Variable Value: C:\Program Files\Java\jdk1.8.0
->System Variables->edit->PATH ->In PATH, add %JAVA_HOME%\bin and %ANT_HOME%\bin….. SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;…. ;%JAVA_HOME%\bin;%ANT_HOME%\bin; …..
6)Verify if ‘C:\Program Files\Java\jdk_x.xx.x\lib’ contains ‘Tools.jar’ file.
7)Run the following command in cmd to verify the correct installation of ANT: ant -version
Update
sf.src = ../SFDC_CI_DEMO/src:
8) Update src path in build.xml and build.properties files.
Example: Please note that SFDC_CI_DEMO†is my project name created in eclipse.
In build.xml set basedir=”../SFDC_CI_DEMO/src” path at first line of code.
In build.properties set sf.src = ../SFDC_CI_DEMO/src†path at last line of code.
9) Install Eclipse with Force.com and Egit IDE (EGit IDE comes with eclipse. Check if it their else install GIT from Help -> Install new software
2.Install GIT
3. Install GITHUB (GitHubSetup.exe) “ This is required to install because if you are using public GitHub repository then you will have you use this to upload build.xml and build.properties files on cloud.
Note: Identify your GitHub repository and keep credentials and repository path handy. It will be required while pushing code from Eclipse to GitHub.
4.Install Salesforce.com ANT Migration tool
5. Install Jenkins
You need to start Jenkins engine if you’ve installed using the .war file. To do this, open command prompt and navigate to the folder where ‘jenkins.war’ file is located. Run the following command:
C:/…>java -jar jenkins.war
If you’ve installed using the windows installer, there’s no need to start Jenkins engine.
To run Jenkins, open your browser and connect to ‘localhost:8080’ Once you see the message “Jenkins is fully up and running means you are ready to go on.
Now open the browser and enter http://localhost:8080/ . Configure Jenkins and configure Job to start using it.
Configuration
Configure Jenkins:
Once your Jenkins is up, goto jenkins > manage jenkins > configure system.
Update the JDK and ANT sections with their respective version and path.
Install GIT plugin from Manage Jenkin -> Manage plugins-> Available & choose GIT plugin to install.
Configure Job:
Go to http://localhost:8080/ and Click on Create New item (using Build a free-style software project option). Enter Item name (This is your project name example SFDC_Deployment) and save.
Select GIT from “Source Code Management section.
Enter Repository URL (Example https://github.com/ABCDEMO/ REPOSITORY1) and provide GITHUB repository password.
Goto ‘Build’ section in the configuration page. Select Ant version.
In the Targets field, enter the library and property file path.
Eg:
-lib
“C:\Program Files (x86)\apache-ant-1.9.2\lib\ant-salesforce.jar”
-Propertyfile
“D:\Users\Username\.jenkins\jobs\JenkinsJobName\workspace\CI\build.properties”
Click on advanced button. In the ‘Build File’ field, enter the the path Ant’s for build.xml
D:\Users\ Username \.jenkins\jobs\SFDC_Deployment\workspace\CI\build.xml
So here is the trick to get the best of out of these build.xml and build.properties files copied from Salesforce ANT tool installation Zip file. Update src path in build.xml and build.properties files.
Example: Please note that SFDC_CI_DEMO†is my project name created in eclipse.
In build.xml set basedir=”../SFDC_CI_DEMO/src” path at first line of code.
In build.properties  set .src = ../SFDC_CI_DEMO/src” path at last line of code.
After setting these paths, will upload these files to GitHub repository and then will sync it will local repository using GITHUB tool installed.
To do this you need to login into GITHUB local tool and navigate to your repository. Now go to settings and open in explorer. It open an explorer window. Create a folder named “CI” and then copy paste build.xml and build.properties updated files in this folder. Now check-in using GITHUB tool providing comment.
In the ‘Properties’ field, enter the salesforce parameters used by Ant in build.xml
sf.username = user@xyz.com
sf.password = PasswordSecurityToken
sf.serverurl = login.salesforce.com
sf.checkOnly = false
sf.runAllTests = false
sf.logLevel = none
Click Save. Your deployment job is ready to go!
We have seen all the technical details of setting up Jenkins that includes configuration of Jenkins and other software requirements.
Let’s see how to process this take the advantage of Jenkins. As discussed in the beginning, it starts with fetching the code in Eclipse.
Let’s start using Eclipse to fetch the code and components locally and to select the right code and components for deployment.
Pranshu Goyal, Director of Products at Mirekta, states: “We envision DSM to be used by every small to a medium-sized organization dealing with bad data and want to get rid of duplicates easily with no cost. We have faced issues dealing with duplicates in our organization. That inspired us to make a solution that is not only simple to use but can be used widely to make the organization’s data clean to make them more efficient and productive. We want DSM to be a solution for every organization looking for duplicate management capability better than the Salesforce out-of-the-box solution with no additional cost.”
Recent Posts
-
Leveraging AI to Enhance Sales Effectiveness13 Mar 2025 Use-case
-
Revolutionizing Manufacturing with AI: Predictive Maintenance, Supply Chain Optimization, and More11 Mar 2025 E-Book
-
NetSuite for Manufacturing: Streamlining Operations and Solving Key Challenges07 Mar 2025 Blog
-
How to Build Your First Agent in Salesforce Agentforce24 Feb 2025 Blog
-
ERP vs Salesforce Revenue Cloud: Which One is Right for Your Business?24 Feb 2025 E-Book
-
Revolutionizing Manufacturing with Salesforce: A Playbook for Efficiency & Growth18 Feb 2025 E-Book
-
Salesforce 2025 Game-Changing Trends You Need to Know28 Jan 2025 Blog
-
Agentforce 2.0: Everything You Need to Know About the Latest Update22 Jan 2025 Blog
-
The Ultimate Guide to NetSuite Development: Tools and Techniques10 Jan 2025 Blog
-
How Salesforce Nonprofit Cloud Transforms Fundraising Strategies10 Jan 2025 Blog
Categories
Featured by



