Sub topic 3
What DevOps Center is and how it is built
DevOps Center is a Salesforce-provided tool that moves changes from development environments to production through a Git repository. It replaces the change set workflow with a source-driven one. This chapter explains what the tool consists of, how its parts connect, and where the common mistakes come from.
This chapter assumes you know the following:
- Basic Salesforce administration: sandboxes, metadata, and change sets.
- Git basics: branches, commits, pull requests, and merges.
- A Git provider account, such as GitHub.
What problem it solves
Change sets move metadata from one org to another by hand. You pick components, upload them, and deploy them on the other side. Nothing records who changed what, there is no review step, and two people can overwrite each other's work without knowing it.
DevOps Center keeps the same goal, which is to ship metadata, but puts a Git repository in the middle. Every change becomes a commit on a branch. Every promotion becomes a merge. The repository holds the history, and the orgs are places where that history gets deployed.
You work through a point-and-click interface, so admins do not need to run Git commands. Developers still get branches, pull requests, and diffs.
The main building blocks
DevOps Center organizes a release process around five objects. Each later chapter covers one of them in detail. This section gives the working model.
| Object | What it is | Example |
|---|---|---|
| Project | The top-level container. It links one repository to one pipeline. | "Sales Cloud releases" |
| Pipeline | An ordered list of stages that a change moves through. | Integration, UAT, Staging, Production |
| Stage | One step in the pipeline. Each stage maps to one environment and one branch. | UAT stage, UAT sandbox, `UAT` branch |
| Environment | A Salesforce org connected to DevOps Center. | A full sandbox or production |
| Work item | One unit of work, such as a user story or a bug fix. It has its own branch. | "Add discount field to Opportunity" |
A project owns exactly one pipeline and one repository. A work item belongs to a project. Work items travel along the pipeline's stages in order.
The key link to remember is stage, environment, and branch. Each stage has one org and one branch. Promoting a work item to a stage merges its changes into that stage's branch and deploys them to that stage's org.
How the pieces fit together
The diagram shows the path of one change.
Read it from left to right:
- A person edits metadata in a development sandbox.
- DevOps Center detects the edit and lists it under the active work item.
- The person commits the listed changes. DevOps Center writes them to the work item branch.
- A pull request merges the work item branch into the branch of the first pipeline stage.
- Promotion then moves the change from stage to stage. Each move merges branches and deploys to that stage's org.
Architecture
DevOps Center is not a separate service you host. It is a managed package installed in an org, which Salesforce calls the DevOps Center org. In practice it runs inside your own production org or a dedicated org, depending on how you enabled it. It has three main parts.
- The application. Lightning pages, objects, and Apex code that show projects, pipelines, and work items.
- Source tracking in the sandboxes. Development sandboxes report which metadata components changed. DevOps Center uses this to build the list of changes you can commit.
- The Git integration. DevOps Center talks to your repository through a connected provider, for example GitHub. It creates branches, commits, and pull requests there on your behalf.
The data model is stored as custom objects in the org that hosts DevOps Center. Work items, projects, and pipeline definitions are records. The metadata itself lives in Git.
Where the source of truth lives
The repository is the source of truth for metadata. The orgs are copies. If an org drifts from the repository, for example because someone edits a field directly in UAT, the next deployment can overwrite that edit, or the two can conflict.
This explains the project layout the repository must follow. DevOps Center expects a standard Salesforce DX project, with an sfdx-project.json file at the root:
{
"packageDirectories": [
{ "path": "force-app", "default": true }
],
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "62.0"
}The path value, force-app, is the directory that holds the metadata DevOps Center reads and writes. The sourceApiVersion value sets the API version used to retrieve and deploy.
You can also keep local tooling files out of deployments with a .forceignore file:
# .forceignore
**/jsconfig.json
**/.eslintrc.json
**/__tests__/**
.sfdx
.sfFiles that match these patterns are skipped during retrieve and deploy. Without them, editor configuration and test folders would travel through the pipeline with real metadata.
What happens during a promotion
A promotion is the most important action in the tool, so it is worth understanding its steps.
- DevOps Center merges the work item branch into the target stage's branch. If a pull request is required, this happens after the pull request is approved.
- It deploys the result to the stage's org.
- It runs tests according to the deployment settings. A failed deployment stops the promotion and reports the error.
Because a merge happens first, Git conflicts surface at promotion time. A later chapter on conflicts covers how to resolve them.
How it differs from change sets and the CLI
| Aspect | Change sets | DevOps Center | Salesforce CLI with your own CI |
|---|---|---|---|
| Source of truth | The orgs | The Git repository | The Git repository |
| Interface | Setup menus | Lightning UI | Command line and scripts |
| Change history | Limited | Full Git history | Full Git history |
| Review step | None built in | Pull requests | Pull requests, if you set them up |
| Custom automation | None | Limited | Fully scriptable |
| Skill needed | Admin | Admin or developer | Developer |
DevOps Center sits between the two ends. It gives admins a guided path and gives developers a Git history. Teams that need custom pipeline logic often use the CLI beside it. The CLI chapter shows how.
You can check what a promotion would carry by comparing the stage branches in Git:
git fetch origin
git log --oneline origin/main..origin/UATThe command lists commits that exist on the UAT branch but not on main. Those are the changes a promotion to the next stage would include. Adjust the branch names to match your own pipeline.
Common errors and gotchas
- Editing a stage org directly. Changes made in UAT or production outside the pipeline are not in Git. The next deployment may overwrite them. Make every change through a work item.
- Expecting every metadata type to work. Some types are not supported by change tracking. A change can happen in the sandbox and never appear in the work item. A later chapter lists the known gaps.
- Mixing up the DevOps Center org and the stage orgs. The org that hosts the tool is not automatically a pipeline stage. Keep the two roles separate in your head.
- Treating branches as informal. Stage branches are controlled by the pipeline. Pushing to them by hand can break the link between a work item and its stage.
- Wrong repository layout. If
sfdx-project.jsonis missing orpathpoints at a folder that does not exist, commits and deployments fail.
Summary of the model
- A project links one repository to one pipeline.
- A pipeline is an ordered list of stages. Each stage has one org and one branch.
- A work item is a unit of change with its own branch.
- Changes flow from a development environment into the work item, then through pull requests and promotions to production.
- Git holds the truth. Orgs receive deployments from it.
Exercise
A teammate fixes a validation rule directly in the UAT sandbox because it is urgent, without using a work item. Two days later, a promotion to UAT deploys a different work item. Describe what can go wrong and what the correct process would have been.
Show answer
The fix exists only in the UAT org, not in Git. The promotion deploys metadata from the repository, so it can overwrite the validation rule with the older version stored in Git, and the fix is lost without warning. The correct process is to make the fix through a work item, in a development environment. The change is then committed to a work item branch, reviewed in a pull request, and promoted through the stages. This way the repository, the review history, and the orgs all agree.
Exercise
A project's pipeline has three stages: Integration, UAT, and Production. How many repositories, pipelines, and stage-to-branch mappings does the project have?
Show answer
One repository and one pipeline, because a project links one repository to one pipeline. Each of the three stages maps to its own branch and environment, so there are three stage-to-branch mappings.