Merge queue implementation in azure #187374
Replies: 6 comments
-
|
You can implement a custom merge queue using Azure Functions or GitHub Actions with a backing store (e.g., Azure Table Storage, Redis, or even GitHub Issues as a queue). Here's a high-level approach:
Useful APIs:
Considerations:
Would you like more specific guidance on any part? |
Beta Was this translation helpful? Give feedback.
-
|
Hi @siva228666, Adding to @pratikrath126's excellent suggestions, if you decide to build this custom engine on Azure, I highly recommend using Azure Durable Functions. Since your requirements include retry/backoff logic and sequential processing, a standard stateless Azure Function might struggle with timeouts during long waits. The Durable Orchestrator pattern fits this perfectly: Smart Retries: You can use context.createTimer within the orchestrator to implement your exponential backoff (wait 5m, then 15m) without keeping a server active/billed during the wait. Queue Management: The orchestrator can serialize the merges. If a PR fails validation (CI/Policy), the function can simply "return" (ejecting it from the logical flow) and immediately trigger the processing of the next PR in the list. One check before you build: |
Beta Was this translation helpful? Give feedback.
-
|
You can implement this using GitHub webhooks + an Azure-backed queue processor. High-level approach:
Key principle: If you're on GitHub Enterprise Cloud, also check whether native Merge Queue fits your needs before building custom logic. |
Beta Was this translation helpful? Give feedback.
-
|
Hi, What you’re describing is basically a non-blocking merge queue, where a bad PR gets skipped instead of blocking the whole lane — and that’s totally doable, but it requires a small orchestration layer on top of GitHub. How you can design it At a high level, you need three pieces:
Store PRs with metadata like:
This worker should:
Handling the “don’t block the lane” requirement The important part is:
So your processor should always: This keeps the lane flowing. Retry / backoff strategy For CI-type failures, add something like:
That way flaky checks don’t permanently block the PR, but also don’t loop forever. Implementation options You can implement this using:
Events you’ll likely listen to:
And for validation you’ll rely on the GitHub REST API:
One thing to consider first Before building this from scratch, check if your org can use GitHub Merge Queue.
If it fits your workflow, it saves a lot of engineering effort. TL;DR Yes — you can build this, but the key ideas are:
That gives you a safe, non-blocking merge lane. |
Beta Was this translation helpful? Give feedback.
-
|
In short, the key is: automated status detection → auto-eject failed PRs → sequential revalidation → ordered merge with retry logic. |
Beta Was this translation helpful? Give feedback.
-
|
For Azure DevOps, I would model this as a small orchestration service rather than trying to make one pipeline responsible for the whole queue. The service can watch pull request status through service hooks or scheduled checks, then use branch policies and build validation as the source of truth. When a PR fails CI, hits a policy issue, or has merge conflicts, the service can mark it as blocked, leave a clear comment for the author, and continue with the next valid PR. That keeps the queue moving without hiding failures. It also gives you a place to handle priority labels, retry logic for temporary failures, and audit logging. The most important part is that every automated decision should be visible to the team, so authors understand why a PR was removed from the lane and how to re-enter it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Body
Objective:
Handle failed PRs in a custom merge flow without blocking other valid PRs.
Requirements:
Automatically detect failed PRs based on:
CI failures
Required checks not passing
Policy validation failures
Merge conflicts
Remove/eject failed PRs from the queue without blocking the lane.
Re-queue and merge remaining valid PRs in order:
Respect priority/labels
Apply retry/backoff logic for transient failures
Guidelines
Beta Was this translation helpful? Give feedback.
All reactions