DevOps is about releasing incremental changes more frequently, and that’s only possible with automation to accelerate your release cycle and drastically reduce manual effort. In particular, continuous integration (CI) streamlines your whole development and release process by automating deployments and validations of your latest changes.
But plenty of Salesforce teams find it tricky to implement reliable automation for CI . One of the main culprits for this challenge is the problem of environments being out of sync. Deployments between out-of-sync environments don’t run reliably, and teammates can still find themselves overwriting each other’s work. Delta CI jobs are a solution that many of these teams use to get started with CI.
The aim of continuous integration
Continuous integration (CI) is the process of frequently merging work back into the main branch, and having CI jobs automatically run tests and deploy to a Salesforce org. This process checks that newly merged work passes your tests and is deployable to Salesforce, so you can continue working in the confidence that your ongoing work shouldn’t fall down later due to a mistake made early on.
Merging work into the main branch frequently as part of continuous integration also helps your team to work more collaboratively. The whole team is working from an up-to-date source of truth, with a codebase that reflects all the latest development work. Fewer conflicts arise and fewer bugs make it to production.
This approach to development where work is merged early and often also leads to features and customizations being delivered to the end users in slices, so they start getting value sooner and can offer feedback early on in the project. The actual release process becomes thoroughly tested because it happens so frequently, and any given release package is easier to debug or roll back because it’s smaller.
How are delta CI jobs different from standard CI?
With a standard Gearset CI job, you can select which metadata types to deploy, and whether you want to deploy new, changed and deleted items. Within those parameters, the CI job will deploy any items where there’s a difference between the source branch and target org.
Delta CI jobs work differently. As the name suggests, they only deploy the delta—that is, only the latest changes that have been made. These are sometimes called ‘commit-by-commit’ deployments, because they just deploy the changes in any new commits since the last commit that was successfully merged into your repository and automatically deployed by the CI job.
There are three main reasons why teams might choose delta CI jobs over standard CI jobs:
1. Delta CI makes overwritten changes less likely
With automation that only deploys the set of changes in your delta, any other differences between your source and target will be left alone. This means that multiple developers or teams contributing to your code base can be sure that committing their changes won’t unintentionally deploy other differences.
2. Delta CI deployments are normally faster
Since delta CI jobs normally deploy a smaller set of changes, the process of fetching and deploying metadata is much quicker. This is especially true if your environments are out of sync, as a standard CI job would find lots of changes to deploy. If everything’s nicely in sync, a standard CI job shouldn’t be too much slower than a delta CI job—but there will still be more metadata to process so a delta CI job will always be the fastest option.
3. Delta CI can help you get started with version control and CI
Teams at an early stage in their DevOps journey will often be working towards most of their metadata being in version control. Until that time, their Git repository only has a subset of metadata, and so isn’t in sync with the Salesforce org that will be the target for their CI job.
Using a delta CI job is a good way of gradually building up the metadata in version control, because there are no wide-ranging implications of a CI job run. Only the latest commits will be deployed. This same principle applies for teams with existing repositories that have become disorganized and need bringing into line with other environments in your release pipeline.
How to set up delta CI for Salesforce
Some developers may be familiar with the sfdx-git-delta
plugin, which can be used alongside automation tools such as Jenkins to achieve delta CI jobs. Building a CI/CD process with open-source tools can take time to set up and then needs to be maintained, so that approach involves a lot of up-front effort and requires an ongoing time commitment.
Gearset’s CI/CD tooling works out of the box and is maintained for you by our responsive development team who are experts in DevOps. Setting up a CI job in Gearset is really straightforward, and it’s easy to keep an eye on all your CI jobs from the user-friendly dashboard.
To set up a delta CI job in Gearset:
From the Continuous integration dashboard, click Add new deployment job.
As part of configuring the CI job to suit your exact needs, head to the Advanced settings tab.
Simply check the box next to Enable delta CI for this job.
An even better approach to continuous integration
Delta CI jobs are great when you’re starting out your DevOps journey, perhaps with a relatively empty Git repo and a bunch of out-of-sync orgs. But if you’re progressing in DevOps maturity and looking for an easy way to keep your orgs in sync, then Pipelines, Gearset’s Salesforce CI/CD solution, is a brilliant next step.
Pipelines gives your whole team an overview of the current state of all the environments in your release pipeline, meaning you can see what changes need to be deployed along the pipeline and back propagated to upstream environments. It functions as the command center and source of truth for your Salesforce release process—even if only some of your team use the rest of Gearset’s DevOps toolset.
Are Delta CI jobs right for your team?
CI is a powerful tool for automating your test and release cycle, which really works best when your environments are as in-sync as possible. For teams that don’t have synced-up orgs and so might find overwriting an issue, delta CI jobs can be a good way to get started. Your team can begin seeing the impact of automation without the risk of stepping on each other’s toes.
If you’re looking for an in-depth guide to CI/CD, addressing all the key questions about release automation, download our free CI/CD for Salesforce ebook.