Salesforce CI/CD: Introduction to Gearset
What is CI/CD?
Continuous Integration or Continuous Delivery is the idea of automating deployments so that that you can continuously integrate and deliver small changes rather than doing massive releases.
CI means setting up an automated process that allows developers or admins to push their changes in real time. The technical goal of CI is to establish a consistent and automated way to build, package, and test applications.
Most teams work with multiple environments other than the production, such as development and testing environments, and CD ensures there is an automated way to push code changes to them.
Typically, this involves using a source control solution (Git, SVN, etc.) and a CI server (e.g. Jenkins, Travis, etc.). Test automation is also a key component of CI. When you want to submit a change, automated tests run so you know whether it’s safe to deploy or not and if they pass you automatically deploy your changes to the target environment.
Major Deployment options in salesforce:
2) Ant migration tool
Changesets is one of the tools provided by Salesforce for migrating metadata changes between connected orgs. It provides a process to synchronize the metadata between a source org and a target org.
Challenges of changesets:
- Destructive changes aren’t supported
- Can’t use the same Changesets across your delivery chain
- Changesets are available only in connected orgs
- Can’t schedule the deployments
- No support for version or source control
- Do not support all types of metadata components
- No governance across the delivery chain
Ant Migration Tool:
The Ant migration tool is a free tool provided by Salesforce. It is a Java/Ant based command line utility for moving metadata between a local folder and an org. It’s also known as the Force.com migration tool.
Challenges of Ant:
- Running deployments with Ant requires manual editing of metadata which is error-prone and time consuming.
- Dependencies for the deployment package must be individually identified and incorporated, requiring a deep knowledge of Salesforce.
- Since it lacks a GUI, the Ant tool has a steeper learning curve than changesets. This lack of interface is a barrier to many non-developers and means many admins and teams are unable to use it at all.
What is gearset and how it is better than changesets and Ant?
Gearset is the modern DevOps tool for Salesforce. It helps teams to compare, move, and track changes between Salesforce environments faster and more easily than ever before.
Gearset was specifically designed to replace changesets and provide admins with a more powerful, yet easy-to-use tool to manage their releases.
Features of gearset which are an advantage over changesets/Ant:
- Custom Comparison filters
- Reusable Custom metadata filters
- Advanced dependency analysis
- Version control
- Complete deployment history
- Deployment Rollback
- Automated change monitoring
- Automated unit testing
- Continuous Integration
- Team collaboration
- Custom Notifications
- Jira Integration
- Data deployments
Release management with gearset:
Let’s see how we can setup Gearset account and managing salesforce & source control connections:
Setup Gearset Account:
- To create an account, go to https://gearset.com/ and click on login
- Log in using one of your existing Salesforce, Google, or LinkedIn accounts
- Click “Allow” when prompted by Salesforce, Google, or LinkedIn
- Complete your Gearset profile by naming your Gearset team (or letting us create one for you using the name generator!) and entering a contact number. You can also opt into receiving occasional product updates by email. Your email subscription preferences can be managed later from the account page of the app.
- Click “Create account” to finish setting up your profile.
That’s it. After signing in you will be redirected to Initial Setup Wizard.
Managing Salesforce connections:
- Click on “METADATA DEPLOYMENTS”, Navigation bar will be opened on the left side of the page
- Click on Manage Salesforce orgs under My Salesforce Connections. You will see list orgs that are connected (if any).
- To add a new connection, click “ADD NEW ORGANIZATION”. You will see different options to connect to Salesforce, click on any one of them and provide the required details
- If you choose Salesforce Authentication, enter salesforce username, select org type and click on Authorize.
- You’ll be prompted to log into Salesforce and authorize Gearset to access this org. Click “Allow” once you’ve logged in. Don’t worry, you’re not changing anything in this org at this stage, this is just allowing Gearset to read the metadata for your first comparison.
Managing Source Control Connections:
- Go to METADATA DEPLOYMENTS, click on MANAGE SOURCE CONTROL AND JIRA
- Click on + Connect to GitHub, It will redirect you to the GitHub login page give your credentials and Sign in. It’ll be directed Gearset page. You see the git username at GitHub (as shown in pic below)
Description of some of gearset features:
- Custom Comparison filters: Create and save your own customized metadata filters for fast, focused and reusable comparisons
- Advanced dependency analysis: Gearset automatically identifies and suggests which dependencies to include in your deployment packages, ensuring more successful deployments
- Version control: Full support for any git-based source control system lets you easily move metadata between repositories and your orgs
- Complete deployment history: View a full history of your deployments across all your orgs and download pdf reports to share with team members for a complete audit trail
- Deployment Rollback: Easily revert unwanted changes with full or partial rollback
- Automated change monitoring: Gain better visibility into changes made across your orgs with daily snapshots, change tracking and custom alerts with on-demand metadata backups for peace of mind
- Automated unit testing: Catch silent test failures, track changes to your code coverage and debug errors with easy automated testing
- Continuous Integration: Keep your orgs in sync and enjoy faster release cycles by creating easy, customizable CI jobs in just a few clicks
- Team collaboration: Experience greater visibility and control through setting team permission levels, delegating access to orgs, shared deployment history and collaborating on building deployment packages
- Jira Integration: Gearset will automatically post updates to your Jira ticket & provide a direct link to your deployments.
- Data deployments: Deploy data subsets between your orgs for more effective testing