Skip to content

CI/CD & Deployment Strategy

CI/CD in Salesforce differs significantly from traditional software CI/CD. The platform’s metadata-driven architecture, shared sandbox environments, and org-based development model create unique challenges. The deployment strategy must balance automation, safety, and team velocity.

The right branching strategy depends on team size, release cadence, and Salesforce-specific constraints.

GitFlow uses long-lived develop and release branches; trunk-based keeps all features in short-lived branches off main.
Figure 1. GitFlow’s develop and release branches suit scheduled Salesforce releases where multiple features must be staged together. Trunk-based development cuts merge conflict risk but demands mature CI/CD automation and feature flags to keep main deployable at all times.
FactorGitFlowTrunk-Based
Release cadenceScheduled releases (monthly, quarterly)Continuous deployment
Team sizeLarge teams (10+)Small to medium teams
Branch lifetimeLong-lived (days to weeks)Short-lived (hours to days)
Merge conflictsHigher risk due to long-lived branchesLower risk with frequent integration
Salesforce fitBetter for change set mentalityBetter for package-based development
ComplexityHigher, more branches to manageLower, fewer branches
Hotfix pathDedicated hotfix branchDirect to main with feature flag
main ← Reflects production state
├── develop ← Integration branch, deployed to SIT
│ ├── feature/JIRA-123-cpq-pricing ← Individual feature work
│ ├── feature/JIRA-456-case-routing ← Individual feature work
│ └── feature/JIRA-789-lead-scoring ← Individual feature work
├── release/2024-Q4 ← Release candidate, deployed to UAT/Staging
└── hotfix/JIRA-999-email-fix ← Emergency production fix

The Salesforce CLI (sf) is the foundation of modern Salesforce DevOps.

CommandPurposePipeline Stage
sf org create scratchCreate scratch org for testingBuild
sf project deploy startDeploy source to an orgDeploy
sf project retrieve startRetrieve metadata from orgDevelopment
sf apex run testExecute Apex unit testsTest
sf package createCreate an unlocked packagePackage
sf package version createCreate a new package versionPackage
sf package installInstall a package into an orgDeploy
sf org delete scratchClean up scratch orgCleanup
  • Source format: Decomposed into individual files (field per file, not all fields in one XML). Produces meaningful diffs and reduces merge conflicts.
  • Metadata format: Monolithic XML files (all fields in one CustomObject.object-meta.xml). Legacy format, harder to diff and merge.

Salesforce provides multiple ways to move metadata between orgs. The right choice depends on team maturity, org complexity, and governance needs.

Change sets sit at the legacy end; unlocked packages and third-party tools represent the modern end of the deployment spectrum.
Figure 2. The migration path from change sets to CLI to unlocked packages is incremental, not a single cutover. DevOps Center provides a GUI on-ramp for admin-heavy teams, while Copado and Gearset add compliance audit trails for enterprise governance requirements.
MechanismRollbackVersion HistoryAutomationDependency MgmtBest For
Change SetsManual undo onlyNoneNoneNoneSmall admin teams, simple changes
Salesforce CLIRedeploy previousGit historyFull CI/CDManual (package.xml)Dev teams with CI/CD pipelines
Unlocked PackagesInstall prior versionPackage versionsFull CI/CDAutomaticLarge orgs, modular architecture
DevOps CenterVia Git historyGit + UI trackingPartialManualMixed admin/dev teams
Copado / GearsetTool-managedFull audit trailFull CI/CDTool-managedEnterprise compliance needs

DevOps Center is Salesforce’s platform-native approach to change management. It provides a UI layer over Git-based source control. DevOps Testing (GA) extends it with automated quality gates.

  • Change tracking: Track work items from development through deployment in a centralized UI
  • Git integration: Built-in source control. Admins and developers see the same change history without learning Git CLI
  • Pipeline management: Promote changes across environments (dev to staging to production) with clicks
  • Conflict detection: Flags conflicting metadata changes across team members before promotion
  • Mixed-team support: Declarative (admin) and programmatic (developer) changes managed in one workflow

DevOps Testing unifies Salesforce and partner testing tools into a single quality-gate framework:

CapabilityWhat It ProvidesStatus
Test strategy definitionsDefine which tests run at each pipeline stageGA
Automated quality gatesBlock promotions that fail test thresholdsGA
Code Analyzer v5Static code analysis integrated into quality gatesGA
Scale TestPerformance and scale testing for deployment validationGA
Partner integrationsACCELQ, Copado, Panaya, Provar, Quality Clouds, TricentisGA
Apex Unit TestsUnified Apex test results in the DevOps Testing dashboardComing soon
Flow TestsFlow test results integrated into quality gatesComing soon
Agentforce Testing CenterTest Agentforce agents with synthetic data before deploymentComing soon

Agentforce (formerly Einstein Copilot) Testing Center provides lifecycle management tooling for testing autonomous AI agents at scale. Teams evaluate agent responses and actions using synthetically generated data, with monitoring of usage and feedback. As Agentforce agents become more common in CTA scenarios, testing them before deployment is an architectural requirement, not optional.

FactorDevOps CenterCopadoGearset
CostIncluded with SalesforceLicensed ($$-$$$)Licensed ($$)
Setup complexityLow (native UI)High (full ALM configuration)Low-moderate
Git managementBuilt-in, UI-basedFull Git integrationFull Git integration
Metadata dependency detectionBasicManual dependency managementAutomatic dependency detection
Compliance / audit trailsBasicStrong (built-in compliance tracking)Moderate
Advanced pipeline featuresLimited (linear promotion)Full (parallel pipelines, branching strategies)Full (flexible pipelines)
RollbackVia Git historyTool-managedTool-managed with comparison
Best forTeams moving off change sets; mixed admin/dev teamsLarge enterprises with strict compliance (finance, healthcare)Mid-size teams prioritizing fast setup and smart diffing

Change sets are the legacy deployment mechanism. CTA scenarios may describe orgs still relying on them.

  • Very small teams (1-2 admins) with simple release processes
  • Admin-only changes (page layouts, validation rules, simple flows)
  • One-time migrations or configuration changes
  • Orgs without source control (though this itself is a problem to fix)
Change Set LimitationWhy It Matters
No rollback capabilityCannot undo a deployment without manual effort
No version historyCannot track what was deployed when
Manual component selectionHuman error in selecting components
No dependency validationMissing components cause deployment failures
No automated testingTests run only if manually included
One-directional (no retrieve)Cannot pull changes back to source control
No diff/comparisonCannot review what changed before deploying

Unlocked packages are Salesforce’s recommended approach for organizing and deploying metadata in large implementations.

Package TypeUse CaseNamespaceUpgradable
Unlocked (no namespace)Internal org developmentNoYes
Unlocked (with namespace)Shared across orgsYesYes
ManagedISV distribution (AppExchange)Yes (permanent)Yes
  • Dependency management: Packages declare dependencies on other packages
  • Versioning: Each package version is a deployable artifact
  • Rollback: Install a previous version to rollback
  • Modular architecture: Organize org metadata into logical packages
  • CI/CD friendly: Package creation can be automated in pipelines
Sales, Service, and Integration packages each depend on a shared Core package containing objects, fields, and permission sets.
Figure 3. Organizing metadata into domain packages with a shared Core dependency lets teams deploy Sales and Service changes independently without touching shared data model components. The Core package becomes the contract all other packages depend on.

In enterprise implementations, packages form a dependency graph. Changes must respect the dependency order: base packages are built and promoted first, then dependent packages.

Core is built first; dependent packages build in dependency order, with Analytics requiring both Core and Sales versions.
Figure 4. The CI/CD build order must respect the dependency graph: Core is always built and promoted first. A package version pinning a minimum Core version means any Core patch below that floor will block installation of dependent packages in production.

Package versioning follows semantic versioning (Major.Minor.Patch.Build):

Version PartWhen to IncrementExample
MajorBreaking changes, removed components1.0 to 2.0
MinorNew features, non-breaking additions2.0 to 2.1
PatchBug fixes, minor improvements2.1.0 to 2.1.1
BuildAuto-incremented by Salesforce2.1.1.1 to 2.1.1.2
ToolTypeStrengthsConsiderations
GitHub ActionsGeneral CI/CDFree for public repos, flexible, strong communityRequires custom SF workflow setup
CopadoSF-native DevOpsBuilt for Salesforce, user stories, complianceLicense cost, vendor dependency
GearsetSF DevOpsExcellent diff/merge, comparison toolsLicense cost, external dependency
FlosumSF-native DevOpsNative on platform, no external toolLimited CI/CD pipeline features
AutoRABITSF DevOpsFull DevOps suite, backup/restoreComplex setup, learning curve
Azure DevOpsGeneral CI/CDEnterprise integration, boards/reposRequires custom SF pipeline
GitLab CIGeneral CI/CDIntegrated repo + CI/CD, self-hosted optionRequires custom SF pipeline
Pull requests trigger scratch org creation, Apex and LWC tests, and static analysis before gating merge and environment promotion.
Figure 5. Each environment gate (SIT integration tests, UAT sign-off, staging smoke tests) catches a different failure class. Collapsing these gates to speed delivery transfers that risk directly to production.
StrategyWhen to UseRisk Level
Big BangSmall changes, low riskLow-Medium
Phased by FeatureMultiple features, independentMedium
Phased by User GroupPilot → rolloutLow
Blue-GreenZero downtime requiredMedium (complex setup)

Deleting metadata requires special handling in Salesforce:

  • Destructive changes manifest: XML file listing components to delete
  • Pre-destructive vs post-destructive: Pre runs before deployment, post runs after
  • Cannot delete components referenced by other deployed components
  • Package versions: Removing components from a package version is not straightforward

Feature flags allow code to reach production without activating it for users:

Implementation options:

  • Custom Metadata Type: Store feature flags as metadata records (deployable, no DML needed to check)
  • Custom Settings: Hierarchy-based, per-user or per-profile (DML to change, quick to toggle)
  • Custom Permissions: Assign via Permission Set (user-level control)

Use cases:

  • Deploy integration code before the external system is ready
  • Gradual rollout to user groups
  • Kill switch for problematic features
  • A/B testing of automation behavior
Deployed code runs legacy logic until the flag is enabled; detected issues revert to legacy by toggling the flag off without redeployment.
Figure 6. Feature flags decouple deployment from release. Code reaches production inactive, then activates per user group or percentage. Disabling the flag is a seconds-long rollback that requires no redeployment and no CAB emergency approval.
  • All tests pass in the source environment
  • Code review completed and approved
  • Deployment validated (check-only deployment) in target
  • Destructive changes documented and reviewed
  • Rollback plan documented
  • Communication sent to affected users
  • Deployment window confirmed (off-peak hours for production)
  • Smoke tests executed in target environment
  • Integration endpoints verified
  • Permission assignments confirmed
  • Monitoring dashboards checked
  • User communication sent (release notes)
  • Deployment logged in release management tracker

Personal study notes for the Salesforce CTA exam. Content compiled from VJ's study notes, official Salesforce documentation, community sources, and online publicly available content, then organized and presented with AI assistance. Not affiliated with Salesforce. © 2025–2026 VJ Srivastava.