Integration · Salesforce

Continuous Integration in Salesforce using Jenkins and Bitbucket

This blog takes you up through the advancement in continuous integration in Salesforce. I will walk through the approach of deploying only the changed element from bit bucket to destination org. The flow starts from polling the Bit bucket repository from Jenkins. If there is any change or new commit happens to the master branch of repository then Jenkins will take the changes from repository and deploy them to the org whose credentials are configured in Salesforce Migration Assistant.

Bitbucket Configuration:

Create a repository in bitbucket. Whenever there is any change in org, commit them to master branch of repository from eclipse with the help of EGit plugin.

bit2

With the help of Puttygen generate SSH key for authentication. Once the key is generated upload the public key by adding SSH key in  bitbucket settings.

bit1

Installation of Jenkins:

By default there is no support for GIT in Jenkins. So go to manage plugins and install the GIT plugin from the available plugins.

jen2

 

Create a new project in Jenkins and provide the bitbucket repository link in the  Source Code Management. Click on Add to create a credential. Use the private key of SSH key generated in puttygen which is stored with extension .ppk in local system.

jen

Either we can run the build manually or we can poll the bitbucket from Build Triggers in Jenkins.

So, in the example I am polling my bit bucket repository for every 5 minutes using Jenkins. So, whenever any commit happens in repository the changes will be deployed to the Salesforce org. For this, install additional plugin called ‘Salesforce Migration Assistant’ in Jenkins.

Steps to install the plugin:

  1. Go to Manage Plugins from Manage Jenkins.
  2. Go to the available tab and search for Salesforce Migration Assistant.
  3. Install the plugin.
  4. Configure the project in Jenkins.(Refer the below images)

This slideshow requires JavaScript.

So when any new commit happens in my master branch that change will be picked up by Jenkins after the polling time and deployed to the org whose credentials are mentioned in Salesforce Migration Assistant.

 

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s