Result: the resources of a directory created or updated in a second workspace, with changes made there since the last promotion kept or refused.
Promote or fork?
- Use promote (
--to) when the directory, usually in git, is the source of truth and the target workspace need not be linked to the source. - Use fork, push and pull when two workspaces should stay linked as parent and child and exchange reviewed changes. They need an Admin on both workspaces, and Enterprise on billing-enabled deployments. See Workflow imports and workspace sync.
Before the first promotion
Set the target's secrets (sim secrets set NAME --scope workspace -w <workspaceId>) and connect its credentials, or the workflows that use them are held back and the apply exits 15.
Promote
Apply a directory read from one workspace (dev) to another (prod) with --to:
Each resource binds by key to the target's own. One the target holds under the same key is updated in place, so a workflow keeps its id and its webhook URLs. A key the target lacks is created. Secrets and credentials bind by name to the target's own, and no value is copied. The directory stays bound to the workspace it was read from. Without --to, check, status, diff and apply act on the workspace the directory was read from, whatever your default workspace; a --workspace naming another one is refused.
Deletes
A resource you deleted from the directory since the last promotion is deleted in the target too, and like any delete it needs --allow-delete. Resources only the target holds, such as a table created in prod and the rows its runs wrote, are kept, with or without --allow-delete: the plan names each with a W_UNDECLARED warning. To delete them as well, pass --delete-target-only beside --allow-delete; the plan then names each with a W_PROMOTE_DELETES_TARGET_ONLY warning, so run it with --dry first.
The target record
Each promotion records what it left in the target in .sim/targets/<workspaceId>.json, and the next promotion compares with that record:
- A resource changed in the target since the last promotion, such as a hotfix made in Sim, is kept when the directory left it alone.
- When the directory changed it too, the promotion is refused as stale and exits
5. Carry the target's change into the source workspace, or undo it in the target, then promote again. - A resource deleted in the target since the last promotion stays deleted, with a
W_PROMOTE_TARGET_DELETEDwarning. Remove its entry from the record to create it again. - The first promotion, and any resource the record does not hold (one created in the target since), updates the target to match the directory. Review the dry run first.
Commit the record with the rest of the directory, so a promotion from CI or another clone compares with it. Don't delete it to get past a stale refusal: without it, the next promotion overwrites every change made in the target since, including rows its workflows wrote.
In CI
To promote after each merge, add the step after the apply to the source workspace and before the step that commits the files back; see Run in CI.