Contributor: @sakib25800

Mentor: @kobzol

Project: Implement merge queue functionality in bors

Organization: The Rust Foundation

https://github.com/rust-lang/bors


Overview

The rust-lang/rust uses a merge queue bot called bors to test and merge pull requests. The old implementation, homu, was difficult to maintain, so a new Rust-based rewrite of bors was started to eventually replace it as the primary merge system.

My GSoC project focused on implementing the missing merge functionality, while also beginning groundwork for the website and preparing for rollups.

Merge queue

The merge queue handles the testing and merging of approved pull requests into the master branch.

My work included adding the merge queue loop to handle approved pull requests, creating auto builds, and merging to master.

Below is an overview of the merge queue process:

sequenceDiagram
    participant PR
    participant bors
    participant GHA
    participant DB

    PR->>bors: @bors r+ (via webhook)
    bors->>Teams API: check user permissions
    bors->>DB: store approval in DB
    bors-->>PR: comment: "Commit abc123 approved"

    bors->>GHA: merge PR with base to `auto-merge`
    bors->>GHA: push merge commit to `auto`
    bors->>GHA: create check run on PR head
    bors->>DB: store auto build
    bors-->>PR: comment: ":hourglass: Testing.."

    GHA-->>bors: workflow started
    bors->>DB: store workflow in DB

    GHA-->>bors: workflow finished
    bors->>DB: update auto build

    GHA-->>bors: (last) workflow finished
    bors->>DB: update build status
    bors->>GHA: update check run on PR head
    bors->>GHA: fast-forward base branch
    bors-->>PR: comment: ":sunny: Test successful"

Related PRs:

https://github.com/rust-lang/bors/pull/350

https://github.com/rust-lang/bors/pull/330

https://github.com/rust-lang/bors/pull/326

https://github.com/rust-lang/bors/pull/321

https://github.com/rust-lang/bors/pull/413