Version control is at the heart of the modern DevOps process for Salesforce. Teams of admins and developers see many key benefits when they start using version control for development and releases, especially around collaboration. This article runs through the basics of Git-based version control, the role version control plays within a streamlined Salesforce release process, and some of the benefits that flow from that.
Another article, Version Control for Salesforce Developers goes on to outline best practices for Salesforce teams looking to implement source-driven workflows.
What’s special about DevOps for Salesforce?
Let’s start by defining what DevOps means within the Salesforce context. DevOps, the merger of development and operations, is a fairly new concept in the Salesforce ecosystem. That’s because Salesforce removes a lot of the complexity you might find on other platforms by handling everything from hosting, scalability and infrastructure for you – all of the backend operations that are typically the responsibility of an operations team.
Salesforce admins, in particular, have benefitted from the platform’s unique “clicks not code” approach to org configuration because it has given them the power to make changes without needing complex developer tooling. By democratizing development and the ability to make customizations in this way, Salesforce has also enabled companies to see a faster return on their investment. As a side effect, however, many of the industry-standard tools and processes used outside the ecosystem haven’t always been adopted quickly for Salesforce.
The relatively simple release management process followed by most teams in the early days, pushing changes along a pipeline of Salesforce orgs, simply doesn’t work any more. Teams find themselves overwriting each other’s work and spending hours on deployments with no way to speed things up. DevOps solves these problems, and version control is the foundation for DevOps that lets you add the following to your process:
- Review & testing
- Rollback options
- Repeatability
- Automation
- Team ownership
Instead of a dedicated DevOps team, teams of Salesforce admins and developers run and maintain the whole development and release cycle themselves. And if anyone’s worried about having to learn complicated developer tools, Salesforce DevOps can be done with clicks not code!
Version control is now essential for Salesforce teams
Version control isn’t a new concept. In fact, it’s been one of the core tools underpinning release management on other platforms for a long time. But until recently, Salesforce teams were behind the curve when it came to adopting version control for the reasons mentioned above. This has changed over the past few years.
As the Salesforce platform has continued to mature and offer more complex functionality, it’s become apparent that version control is a necessary key tool for every Salesforce team. Recently, the ecosystem has seen a transition to source-driven workflows – and in a big way! Gearset’s State of Salesforce DevOps 2021 report surveyed more than 500 Salesforce professionals and found that just under 70% have already incorporated version control into their process in some fashion.
What’s version control all about?
Before we explore why version control is so crucial to Salesforce DevOps, let’s just run through a quick summary of what version control is all about.
- Version control tracks changes to files over time, which can be anything from text files to the Salesforce metadata that makes up the structure of your org. It gives you a complete history of every change that was made to any file, at any time, by anyone.
- There are many flavors of version control, but Git is the de facto standard for Salesforce. Git provides teams with the ability to separate out multiple streams of development and avoid stepping on each other’s toes by making changes in isolated branches, instead of in shared sandboxes.
- Git replaces your production org as a shared source of truth for your whole team. Each repository has a “main” or “master” branch, which holds the latest “production ready” versions of all files. By having everyone work from this single starting point, it’s easy for teams to have a shared understanding of what’s been reviewed.
- Version control lets you review and integrate changes before release, so you can deal with any conflicts ahead of time.
All of these features combined give you huge advantages over Salesforce’s native change management process. They make collaboration with developers much easier and give you a comprehensive way of managing everyone’s changes as they make their way to production.
How teams work with version control
Visualizing version control is the best way to get a hang of the terminology around it.
Tracking files in a repo
In version control, all of your project files – your Salesforce metadata like profiles, custom objects and the custom Apex code created by developers on your team – live inside a repository or “repo”, which tracks the change history of these files.
Git hosting platforms
Normally Salesforce teams will have a centrally hosted repo that acts as the source of truth, usually hosted on a Git hosting platform such as GitHub or GitLab. Both admins and developers can interact with the centrally hosted repo by using a clicks-based DevOps solution for Salesforce. While developers will also work from a local copy of the repository on their computer, third-party DevOps tools allow admins to manage deployments between their version control system and their various Salesforce orgs.
Branching
When you’re going to make changes to your sandbox or create a new feature in a development environment, you start by creating a separate branch, often called a “feature” branch, off of the “main” or “master” branch. This feature branch will include a copy of all the files present in the main/master branch. By creating this feature branch, you can safely make changes to the files in a separate environment from your teammates. Again, this is something anyone can do without having to use a developer’s command-line interface (CLI) if your team has a third-party tool that supports creating and deploying to branches.
Committing changes
Every so often, while working on changes in your org, it’s good practice to “commit” (deploy) those changes to your feature branch. You should do this at various points, after each logical step in your work. Each branch becomes a group of related changes that together will form the final feature you’re working on. Here again, you can use the UI of a Salesforce DevOps tool to make the deployments from a sandbox to version control.
Pull requests
When your work is done, you create a “pull request” to merge your feature branch back into the main branch. A pull request essentially provides a mechanism for review and approval, as well as automating the process of combining files, before the changes can be released into downstream orgs and finally into production.
A single, shared process for admins and developers
So let’s pull it all together into a basic source-driven workflow for Salesforce that will look something like this:
In the above diagram, an admin works in a sandbox, deploys the changes as commits to a feature branch, and then opens a pull request to merge the work into the master branch. The developer does the same, but with the difference that new features are first developed in the IDE before being deployed to a sandbox or Salesforce development environment. These changes can be released together with production. The key point is that everyone on the team is using a single source of truth in version control and deploying changes down the pipeline using the same process. This way of working unlocks significant benefits.
The benefits of working with version control
Teams using version control have greater control over the changes being pushed down the pipeline, which in turn gives them the following key benefits (among others):
Enhanced collaboration that scales
When you have multiple admins and developers working on the same org, there’s always a risk that changes get overwritten, different contributions run into conflicts, or something gets broken in production. Branching in version control not only lets your team avoid this risk and work effectively in parallel on the same features, but also helps you scale your release process to a team of any size.
As your team and the complexity of your workstreams increase, you can add any number of sandboxes and pre-production testing orgs to the process. This is a tried and tested approach – almost every big tech company out there, from Amazon to Microsoft to Google is using version control at the heart of their development practices and it’s proven to work at massive scale.
Automated deployments and testing
Once you’ve got a well-honed manual process up and running with a Git-based workflow, your team is ready to add automation into the mix. Automation helps you keep all your environments in sync, test and validate changes, and takes the pain and risk out of manually deploying the same changes to update multiple sandboxes, testing environments and production. Automation is the jewel in the DevOps crown, giving you a repeatable and faster way to ship changes between Salesforce orgs.
Increased release velocity
Faster deployments allow for more frequent deployments, which in turn encourage teams to ship fewer changes at any one time. The smaller the number of changes in any release, the easier it is to test and the lower the risk of releasing it. And if it does go wrong, it’s much easier to revert or rollback a small number of changes than, say, a whole month’s worth of configuration!
Higher-quality, lower-risk releases
By adopting this rapid cadence, teams naturally move into the habit of quick iterations and regular feedback, and these tighter feedback loops result in better quality releases with features that are more relevant to end users. Hopefully, you can see how all this can rapidly build to a whole lot of improvement in a deployment pipeline compared to change sets!
Want to get to grips with version control?
A quick way to get up and running is by completing the free training courses on DevOps Launchpad, which gives you a fun way to learn more about the fundamentals of version control and all about Salesforce DevOps with an opportunity to earn valuable certifications. Whether you work as an admin, developer or architect, Salesforce professionals with DevOps expertise are in huge demand, so now is the right time to start acquiring these useful skills.
For practical advice on how to implement version control and start building out a DevOps process for your team, see the follow-up guide Version Control for Salesforce Developers.