Sub topic 3
Running a Salesforce Quick Deploy
Assume you know Salesforce metadata, sandboxes, production orgs, Apex tests, and basic sf commands. A quick deploy installs a deployment that already passed validation. It does not run the tests again.
Running a quick deploy
Keep the validation job ID. It identifies the exact metadata and test results that Salesforce validated.
sf project deploy quick \
--job-id 0AfXXXXXXXXXXXXXXX \
--target-org prodThe validation must be successful, still eligible, and unchanged. The quick deploy uses the same components, test level, and target org as the validation. Salesforce normally keeps a validation eligible for up to 10 days. Check the status first when the release is delayed:
sf project deploy report \
--job-id 0AfXXXXXXXXXXXXXXX \
--target-org prodA successful quick deploy changes the target org. A failed quick deploy does not complete the release.
Doing it in Setup
In Setup, open Deployment Status in the target production org. Find the validated deployment and choose Quick Deploy. For an outbound change set, upload the change set from the source org first. In production, open Deployment Status, select the inbound change set, and validate it. After validation succeeds, choose Quick Deploy for that validation.
The Setup page and CLI must refer to the same target org and validated deployment. Record the validation ID in a release ticket.
Troubleshooting failures and missing Quick Deploy
Common causes include:
- The validation failed because of compilation errors, test failures, missing dependencies, or insufficient code coverage.
- The validation expired.
- The deployment contents changed after validation.
- The command uses a different target org or job ID.
- A package, component, or test requirement makes the deployment ineligible.
Run the deployment report and inspect the first meaningful error. Fix the source, create a new validation, and use its new job ID. Do not assume that a later successful deployment has replaced the earlier validation.
Automating with the Metadata API and CI
A CI pipeline can submit a validation through the Metadata API, save the returned deployment ID, poll for completion, and call deployRecent with that ID during the release. Store the ID as build metadata, not as an untracked console value. Use protected credentials and require an approval before production quick deploy.
Planning around a release window
Validate before the release window, after the final metadata commit is ready. Reserve the window for checking results, approving the release, and running quick deploy. If validation is too old or the commit changes, validate again before deploying.
Exercise
Why should a release team save the validation job ID?
Show answer
Quick deploy needs that ID to identify the exact successful validation and its deployment contents.