What is Continuous Integration?
Continuous integration (CI) is the concept of frequently building and testing code to merge changes and find problems as quickly as possible rather than waiting for a scheduled deployment.The benefit of this methodology is, by finding problems quickly the developers can fix the problems at a quicker rate and thus resulting in reduced risk and smooth project roll-out.This approach is most appropriate for larger teams that have developers working in their own separate Dev orgs. It also requires the team to be using a source control manager. Use of this approach requires using a CI manager like Cruise Control or Jenkins that runs on its own server.
Logical Architecture
Each developer has his own individual developer sandbox They check their code into a shared Version Control tool repository.
Continuous Integration tools like Jenkins or Cruise Control are installed on a build machine, and it periodically checks the Version Control tool repository. If it detects any change in the repository, it retrieves the files and performs a deployment against an org by invoking the deploy task in the Force.com migration tool
Process flow of CIS:
Continuous Integration Processes:
•Installation Processes:
- Version Control System - Github or Bitbucket
- Continuous Integration System (CIS) - Jenkins
- Integrate VCS with Build Tool (Force.com Migration tool) - Ant
•Configuration Processes:
- Version Control System
- Build Tool (Force.com Migration Tool)
- Continuous Integration Tool
•Execution Processes:
- Version Control System
- Build Tool (Force.com Migration Tool)
- Continuous Integration Tool
•Installation Processes:
1. Version Control System:
There are some version control system available such as https://bitbucket.org/ and https://github.com/, create an account and create a repository. Lets take the github as an example. once you create a repository you will get a clone URL keep that URL we will use later on.
You need to download git for windows as well for your local repository. Go to URL https://git-scm.com/downloads. You will need
You can download Tortoisegit, its a GUI to intact with git https://code.google.com/p/tortoisegit/wiki/Download
We can download eclipse plugin as well, but as of now we will continue with git and tortoisegit.
2.Continuous Integration System:
Go to URL : http://mirrors.jenkins-ci.org/windows/
Install Jenkins and open a web browser and go to URL http://localhost:8080
Click on New Item and select Build a free style Software project.
3.Ant:
Go to URL: https://ant.apache.org/bindownload.cgi and download the latest ant and install it. You can get more details how to setup ant for salesforce using this link https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/forcemigrationtool_install.htm
•Configuration Processes:
Once we are done with github and installation of Jenkins and Ant then we need to know how we can sync local repository with remote to commit changes.
1. Create a Folder in your local system and select the folder and right click
2. Click on git clone option, paste your repository URL and click "OK"
3. Provide git username and password when prompt
1. Create a Folder in your local system and select the folder and right click
2. Click on git clone option, paste your repository URL and click "OK"
3. Provide git username and password when prompt
4. Using ant you can fetch the source code and push into Git.
Jenkins Configuration for CI:
1. Select the created Item and click on Configuration, in Source Code Management select Git and provide the required details.
2. In Schedule you can put H/15 * * * *, if you want to poll in each 15 min.
3. Go to Build section and click on Add build step and provide the local Ant
4. You can provide Email in E-mail notification under Post build Action.
5. Click on Save.
•Execution Processes:
1. Retrieve updated code and push into Git using TortoiseGit.
2. Wait for 15 min or as per your Jenkins poll setting.
3. Check Build history in Jenkins, you will see the latest build execution details in console output.
Hope this will be useful.....