Sub topic 11
Promoting Work Items to Production
This chapter assumes you know how a work item reaches a pull request (covered in the previous chapters). You should also know your project's pipeline stages and how Git branches map to them.
What promotion does
Promotion moves the changes of one or more work items from one pipeline stage to the next. DevOps Center merges the work item's changes into the branch that belongs to the next stage. It then deploys that branch's metadata to the org connected to that stage.
A typical pipeline has stages such as Integration, UAT, Staging and Production. Each stage has its own environment and its own branch. A work item must pass through them in order.
Running a promotion
- Open the project and select the pipeline stage that holds the work items you want to move.
- Select the work items. Only items that have passed the stage's checks are available.
- Choose Promote. DevOps Center creates the merge into the next stage's branch.
- Wait for the deployment. DevOps Center shows its status on each work item.
- Repeat for each later stage until the item reaches Production.
Work items can be promoted together as a bundle. A bundle is useful when two items depend on each other. A bundle also means that a failure in one item blocks the others.
Checking before you promote
You can compare what a stage would receive. Commits that have reached UAT but not yet the main branch are the ones a promotion carries:
git fetch origin
git log --oneline origin/main..origin/UATYou can also run a validation-only deployment against the target org. A validation checks the deployment and runs tests, but it does not change the org:
sf org login web --alias uat
sf project deploy start --source-dir force-app --target-org uat --dry-run --test-level RunLocalTestsCommon errors
- Deployment fails on a missing dependency. The work item references metadata that has not reached the target stage. Promote the dependency first, or bundle the items.
- Merge conflict during promotion. Another work item changed the same component. Resolve it as described in the conflicts chapter, then promote again.
- Tests fail in the target org. Production deployments run tests, and a test that passed in a sandbox can fail where the data differs. Fix the cause in a new commit on the work item branch.
- Item does not appear for promotion. The pull request is not merged, or a required check has not finished.
After the release
When Production deployment succeeds, the work item moves to its final state and is complete. Check the work item status and the deployment result in Setup. Confirm the change behaves as expected in the live org.
Exercise
A work item deployed successfully to UAT, but promotion to Staging fails with a missing field error. The field belongs to another work item that is still in Integration. What are two ways to fix this?
Show answer
Promote the work item that creates the field through the earlier stages first, so the dependency reaches Staging before the dependent item. Alternatively, bundle both work items and promote them together. Either way, the field must exist in the target stage when the dependent change deploys.