ShopifyDarren WorrallAnnouncement
Introducing the Merge Queue
Summary
Shopify describes a merge queue added to Shipit to reduce failures in its large monolithic Rails application, where growing pull request volume made manually checking whether master was safe unsustainable. The queue adds pull requests from GitHub, merges them when master is healthy, waits for required CI statuses, and can reject stale branches using configurable divergence thresholds. It is encouraged rather than enforced, while changing the browser extension’s visual emphasis helped make queued merging the default workflow; over 90% of core application pull requests use it. Shipit also handles unsafe deployment commits by allowing explicit marking and automatically detecting reverts of undeployed commits, marking the original and intermediate commits unsafe. These changes let deployment continue safely around reverted work without requiring developers to manually unlock the pipeline.
Context
Shopify’s trunk-based workflow produced an increasing number of merge failures as developer and pull request volume grew. Shipit already tracked the state of master and deployments, including conditions under which further merges should pause, making it the location for merge automation.
Approach / What changed
Shipit added queueing through its GitHub integration and browser extension, waits for pending CI, applies configurable branch-divergence limits, and permits developers to bypass the queue. It also supports manually marking commits unsafe for deployment and automatically detects reverts of undeployed commits, marking the reverted and intermediate commits unsafe.
Takeaways
The merge queue waits for pending CI and merges or rejects a queued pull request instead of ejecting it and requiring manual re-enqueueing.
Configurable thresholds let Shipit reject pull requests whose branches have diverged too far by age or commit count.
When Shipit detects a revert of an undeployed commit, it marks the original commit and intermediate commits unsafe for deployment.
FAQ
What happens when a queued pull request is still waiting for CI?
Shipit keeps the pull request in the queue while CI is pending. It merges it if CI passes or rejects it if CI fails, allowing developers to queue and move on.
Can developers still merge directly to master?
Yes. The merge queue is highly encouraged but not enforced, and Shopify allows developers to override the automation when they believe it is required.
How does Shipit handle a reverted commit that has not deployed yet?
Shipit detects the revert and marks the original undeployed commit unsafe for deployment, along with intermediate commits between it and the revert. This lets the deployment pipeline continue without manually configuring each unsafe commit.
Source and freshness
- Source
- shopify.engineering
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.