Salesforce runs one deployment per org at a time, and a deployment with tests can take a long time. So what should your CI do when new commits arrive while an older one is still deploying? Most pipelines have no answer, and run every job in order. This post lays out the options and the one condition that decides which are safe.
The scenario
You have a CI job that validates or deploys on every push to a branch. A deployment takes 25 minutes.
0:00 Push 1 arrives and starts running.
0:10 Push 2 arrives and waits.
0:15 Push 3 arrives and waits behind push 2.
Run in order, push 3 is live at about 1:15, an hour after you pushed it. If push 3 contains everything from pushes 1 and 2, the first two runs were wasted time.
Three policies
Policy What happens Good for
Run every job 1, then 2, then 3. Nothing is skipped. Production deployments, where each merge should have its own run and its own history.
Skip stale waiting jobs Push 2 is dropped. Push 1 finishes, then push 3 runs.…